source: trunk/SRC/ToBeReviewed/LECTURE/GRIB/read_grib_gds.pro @ 288

Last change on this file since 288 was 262, checked in by pinsard, 17 years ago

corrections of some headers and parameters and keywords case. change of pro2href to replace proidl

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1;+
2; @file_comments
3;
4;
5; @categories
6;
7;
8; @param NUM
9;
10;
11; @param RECSTART
12;
13;
14; @returns
15;
16;
17; @restrictions
18;
19;
20; @examples
21;
22;
23; @history
24;
25;
26; @version
27; $Id$
28;-
29;
30FUNCTION read_grib_gds, num, recstart
31;
32;
33  compile_opt idl2, strictarrsubs
34;
35  offset = recstart+8
36  a = assoc(num, bytarr(1, /nozero), offset-1)
37  sizepds = bit2int([binary(a[1]), binary(a[2]), binary(a[3])])
38;
39  offset = recstart+8+sizepds
40  a = assoc(num, bytarr(1, /nozero), offset-1)
41;
42  sizegds = bit2int([binary(a[1]), binary(a[2]), binary(a[3])])
43;
44  nv = (a[4])[0]
45  pv = (a[5])[0]
46;
47  gridtype = (a[6])[0]
48;
49  CASE 1 OF
50; Latitude/Longitude Grid
51; Gaussian Latitude/Longitude Grid
52    gridtype EQ 0 OR gridtype EQ 4:BEGIN
53      ni = bit2int([binary(a[7]), binary(a[8])])
54      nj = bit2int([binary(a[9]), binary(a[10])])
55;
56      la1 = bit2int([binary(a[11]), binary(a[12]), binary(a[13])], /checkneg)/1000.
57      lo1 = bit2int([binary(a[14]), binary(a[15]), binary(a[16])], /checkneg)/1000.
58;
59      resflags = binary(a[17])
60;
61      la2 = bit2int([binary(a[18]), binary(a[19]), binary(a[20])], /checkneg)/1000.
62      lo2 = bit2int([binary(a[21]), binary(a[22]), binary(a[23])], /checkneg)/1000.
63;
64      di = bit2int([binary(a[24]), binary(a[25])])/1000.
65      IF di EQ 65.5350 THEN di = -1
66;
67      IF gridtype EQ 0 THEN BEGIN
68        dj = bit2int([binary(a[26]), binary(a[27])])/1000.
69        IF dj EQ 65.5350 THEN dj = -1
70      ENDIF ELSE BEGIN
71        n = bit2int([binary(a[26]), binary(a[27])])
72      ENDELSE
73;
74      scanflags = binary(a[28])
75;
76      res = {size:sizegds, gridtype:gridtype, ni:ni, nj:nj, la1:la1, la2:la2, lo1:lo1, lo2:lo2, di:di}
77      IF gridtype EQ 0 THEN res = create_struct(res, 'dj', dj) $
78      ELSE res = create_struct(res, 'n', n)
79      RETURN, res
80    END
81; Mercator Projection Grid
82    gridtype EQ 1:
83; Gnomonic Projection Grid
84    gridtype EQ 2:
85; Lambert Conformal, secant or tangent, conical or bipolar (normal or
86; oblique) Projection Grid 
87    gridtype EQ 3:
88; Polar Stereographic Projection Grid
89    gridtype EQ 5:
90; Oblique Lambert conformal, secant or tangent, conical or bipolar,
91; projection
92    gridtype EQ 13:
93; Spherical Harmonic Coefficients
94    gridtype EQ 50:
95; Space view perspective or orthographic grid
96    gridtype EQ 90:
97; reserved - see Manual on Codes
98    ELSE:
99  ENDCASE
100;
101  RETURN, -1
102END
Note: See TracBrowser for help on using the repository browser.