1 | /*** FILE: grib.h ***/ |
---|
2 | /* Revisions: |
---|
3 | 10/16/97/atn: +usData_type to mercator, space view structs |
---|
4 | 11/04/97/atn: reduced DEF+MSG_LEN from 250k; |
---|
5 | 02/18/98/atn: + Projection codes; -ENC_DELIMITOR; -struct space_view; |
---|
6 | 04/22/98/atn: + extension flag; |
---|
7 | */ |
---|
8 | |
---|
9 | #define EXTENSION_FLAG 99 /* Implies extensions if equals PDS Oct41 */ |
---|
10 | #define DEF_MSG_LEN 50000 /* size of GRIB HDR 's entire_msg */ |
---|
11 | #define MAX_PROJ_SIZE 46 /* MaxSize of GDS minus 6 bytes*/ |
---|
12 | /* Currently set to LATLON; */ |
---|
13 | /*#define MAX_INP_PROJ_SIZE 72*/ /* Size of Max Input GDS block, */ |
---|
14 | /* currently set to GDS_LATLON_INPUT */ |
---|
15 | /* Todd Hutchinson 8/11/05 */ |
---|
16 | /* |
---|
17 | * The above definition for MAX_INP_PROJ_SIZE only works with machines that |
---|
18 | * have 4 byte long ints. Here, we will quadruple this to handle up to |
---|
19 | * 16 byte long ints. This was an issue on the IBM in 64 bit mode. |
---|
20 | */ |
---|
21 | #define MAX_INP_PROJ_SIZE 288 |
---|
22 | |
---|
23 | /* WMO projection codes |
---|
24 | *** MUST keep parallel to 'prjn_name' array *** |
---|
25 | *** IF altered, must also update the 'PRJ_COUNT' *** |
---|
26 | */ |
---|
27 | #define LATLON_PRJ 0 |
---|
28 | #define MERC_PRJ 1 |
---|
29 | #define LAMB_PRJ 3 |
---|
30 | #define GAUSS_PRJ 4 |
---|
31 | #define POLAR_PRJ 5 |
---|
32 | #define ALBERS_PRJ 8 |
---|
33 | #define ROT_LATLON_PRJ 10 |
---|
34 | #define OBLIQ_LAMB_PRJ 13 |
---|
35 | #define ROT_GAUSS_PRJ 14 |
---|
36 | #define STR_LATLON_PRJ 20 |
---|
37 | #define STR_GAUSS_PRJ 24 |
---|
38 | #define STR_ROT_LATLON_PRJ 30 |
---|
39 | #define STR_ROT_GAUSS_PRJ 34 |
---|
40 | |
---|
41 | #define PRJ_COUNT 35 /* num of elements in prjn_name[] */ |
---|
42 | |
---|
43 | /* WMO projection names (use WMO codes above to index) */ |
---|
44 | static char* prjn_name[] = { |
---|
45 | "(0) Latitude/Longitude Grid", |
---|
46 | "(1) Mercator Grid", |
---|
47 | "(2) Unsupported Grid", |
---|
48 | "(3) Lambert Grid", |
---|
49 | "(4) Gaussian Grid", |
---|
50 | "(5) Polar Grid", |
---|
51 | "(6) Unsupported Grid", |
---|
52 | "(7) Unsupported Grid", |
---|
53 | "(8) Albers equal-area Grid", |
---|
54 | "(9) Unsupported Grid", |
---|
55 | "(10) Rotated Latitude/Longitude Grid", |
---|
56 | "(11) Unsupported Grid", |
---|
57 | "(12) Unsupported Grid", |
---|
58 | "(13) Oblique Lambert Grid", |
---|
59 | "(14) Rotated Gaussian Grid", |
---|
60 | "(15) Unsupported Grid", |
---|
61 | "(16) Unsupported Grid", |
---|
62 | "(17) Unsupported Grid", |
---|
63 | "(18) Unsupported Grid", |
---|
64 | "(19) Unsupported Grid", |
---|
65 | "(20) Stretched Latlon Grid", |
---|
66 | "(21) Unsupported Grid", |
---|
67 | "(22) Unsupported Grid", |
---|
68 | "(23) Unsupported Grid", |
---|
69 | "(24) Stretched Gaussian Grid", |
---|
70 | "(25) Unsupported Grid", |
---|
71 | "(26) Unsupported Grid", |
---|
72 | "(27) Unsupported Grid", |
---|
73 | "(28) Unsupported Grid", |
---|
74 | "(29) Unsupported Grid", |
---|
75 | "(30) Stretched Rotated Latlon Grid", |
---|
76 | "(31) Unsupported Grid", |
---|
77 | "(32) Unsupported Grid", |
---|
78 | "(33) Unsupported Grid", |
---|
79 | "(34) Stretched Rotated Gaussian Grid" |
---|
80 | }; |
---|
81 | |
---|
82 | /*.................................................................*/ |
---|
83 | typedef struct GRIB_HDR { /* holds one Grib Msg & its info */ |
---|
84 | char shuffled; /* set if sections are out of order */ |
---|
85 | long msg_length; /* length in bytes of entire msg */ |
---|
86 | long ids_len; /* length in bytes of Ident Sect */ |
---|
87 | long pds_len; /* length in bytes of Prod Defn Sect */ |
---|
88 | long gds_len; /* length in bytes of Grid Defn Sect */ |
---|
89 | long bms_len; /* length in bytes of Bitmap Sect */ |
---|
90 | long bds_len; /* length in bytes of Bin Data Sect */ |
---|
91 | long eds_len; /* length in bytes of Ending Sect */ |
---|
92 | long abs_size; /* num bytes malloced to entire_msg*/ |
---|
93 | unsigned char *entire_msg; /* arr holding entire Grib msg */ |
---|
94 | unsigned char *ids_ptr; /* pts to 'GRIB' w/in entire msg */ |
---|
95 | unsigned char *pds_ptr; /* pts to PDS w/in entire msg */ |
---|
96 | unsigned char *gds_ptr; /* pts to GDS w/in entire msg */ |
---|
97 | unsigned char *bms_ptr; /* pts to BMS w/in entire msg */ |
---|
98 | unsigned char *bds_ptr; /* pts to BDS w/in entire msg */ |
---|
99 | unsigned char *eds_ptr; /* pts to '7777' w/in entire msg */ |
---|
100 | } GRIB_HDR; |
---|
101 | |
---|
102 | typedef struct PDS_INPUT{ /* User input structure - PDS */ |
---|
103 | unsigned short uslength; /* PDS Length - depends on extensions */ |
---|
104 | unsigned short usEd_num; /* GRIB Edition number - #1 (IndS) */ |
---|
105 | unsigned short usParm_tbl; /* Parameter table number (1) */ |
---|
106 | unsigned short usCenter_id; /* Id of originating center (Table 0)*/ |
---|
107 | unsigned short usProc_id; /* Generating process Id number (Table A) */ |
---|
108 | unsigned short usGrid_id; /* Grid Identification (Table B) */ |
---|
109 | unsigned short usGds_bms_id; /* GDS and BMS flag (Table 1) */ |
---|
110 | unsigned short usParm_id; /* Parameter and unit id (Table 2) */ |
---|
111 | unsigned short usLevel_id; /* Type of level or layer id (Table 3/3a) */ |
---|
112 | unsigned short usLevel_octets; /* number of octets used in Table 3 (0, 1, 2 values) */ |
---|
113 | unsigned short usHeight1; /* Height1, pressure1,etc of level (Table 3)*/ |
---|
114 | unsigned short usHeight2; /* Height2, pressure2,etc of level (Table 3)*/ |
---|
115 | unsigned short usYear; /* Year of century -Initial or ref. */ |
---|
116 | unsigned short usMonth; /* Month of year -time of forecast */ |
---|
117 | unsigned short usDay; /* Day of month */ |
---|
118 | unsigned short usHour; /* Hour of day */ |
---|
119 | unsigned short usMinute; /* Minute of hour */ |
---|
120 | unsigned short usFcst_unit_id; /* Forecast time unit (Table 4) */ |
---|
121 | unsigned long usP1; /* Period of time (Number of time units) */ |
---|
122 | unsigned long usP2; /* Time interval between forecasts */ |
---|
123 | unsigned short usTime_range; /* Time range indicator (Table 5) */ |
---|
124 | unsigned short usTime_range_avg; /* Number included in average if flag set */ |
---|
125 | unsigned short usTime_range_mis; /* Number missing from average */ |
---|
126 | unsigned short usCentury; /* Centry of Initial time (19) */ |
---|
127 | unsigned short usCenter_sub; /* Oct 26: Sub Center id */ |
---|
128 | short sDec_sc_fctr; /* Decimal scale factor */ |
---|
129 | unsigned short ausZero[12]; /* Reserved */ |
---|
130 | unsigned short usExt_flag; /* Oct 41: Grib extensions usage flag*/ |
---|
131 | unsigned short usSecond; /* Second of Minute */ |
---|
132 | unsigned short usTrack_num; /* Tracking ID for data set */ |
---|
133 | unsigned short usParm_sub; /* Sub-Table Entry for parameter and unit (Table 2) */ |
---|
134 | unsigned short usSub_tbl; /* Sub-Table version number */ |
---|
135 | /* WSI Extended PDS fields */ |
---|
136 | unsigned short PDS_41; /* Forecast time 1 unit id - Table 4 */ |
---|
137 | long PDS_42; /* forecast time 1 (up to 4 bytes) */ |
---|
138 | unsigned short PDS_46; /* Forecast time 2 unit id - Table 4 */ |
---|
139 | long PDS_47; /* forecast time 2 */ |
---|
140 | unsigned short PDS_51; /* Time range indicator - Table 5 */ |
---|
141 | unsigned short PDS_52; /* Top of atmosphere--used with sigma coord*/ |
---|
142 | }PDS_INPUT; |
---|
143 | |
---|
144 | typedef struct GDS_LAM_INPUT { /* Input: Lambert Conformal Grid */ |
---|
145 | unsigned short usData_type; /* Data representation type ( Table 6) */ |
---|
146 | int iNx; /* Nx - # of points along x-axis */ |
---|
147 | int iNy; /* Ny - # of points along y-axis */ |
---|
148 | long lLat1; /* Latitude of first grid point */ |
---|
149 | long lLon1; /* Longitude of first grid point */ |
---|
150 | unsigned short usRes_flag; /* Resolution and component flag (Table 7)*/ |
---|
151 | long lLon_orient; /* Orientaion of grid - longitude */ |
---|
152 | unsigned long ulDx; /* X-direction grid length */ |
---|
153 | unsigned long ulDy; /* Y-direction grid length */ |
---|
154 | unsigned short usProj_flag; /* Projection center flag */ |
---|
155 | unsigned short usScan_mode; /* Scan mode */ |
---|
156 | long lLat_cut1; /* First latitude which secant cone cuts */ |
---|
157 | long lLat_cut2; /* Second latitude from pole */ |
---|
158 | long lLat_southpole; /* Latitude of southern pole (millidegree)*/ |
---|
159 | long lLon_southpole; /* Longitude of southern pole */ |
---|
160 | int usZero; /* Reserved (set to 0) */ |
---|
161 | }GDS_LAM_INPUT; |
---|
162 | |
---|
163 | typedef struct GDS_LATLON_INPUT{ /* Input: Latitude/Longitude Grid */ |
---|
164 | unsigned short usData_type; /* Data representation type ( Table 6) */ |
---|
165 | int usNi; /* Number of points along a parallel */ |
---|
166 | int usNj; /* Number of points along a meridian */ |
---|
167 | long lLat1; /* Latitude of first grid point */ |
---|
168 | long lLon1; /* Longitude of first grid point */ |
---|
169 | unsigned short usRes_flag; /* Resolution and component flag (Table 7)*/ |
---|
170 | long lLat2; /* Latitude of last grid point */ |
---|
171 | long lLon2; /* Longitude of last grid point */ |
---|
172 | int iDi; /* I-direction increment */ |
---|
173 | int iDj; /* J-direction increment */ |
---|
174 | unsigned short usScan_mode; /* Scanning mode (Table 8) */ |
---|
175 | long usZero; /* Reserved (set to 0) */ |
---|
176 | long lLat_southpole; /* Latitude of southern pole (millidegree)*/ |
---|
177 | long lLon_southpole; /* Longitude of southern pole */ |
---|
178 | long lRotate; /* Angle of rotation */ |
---|
179 | long lPole_lat; /* Latitude of pole of stretching (millidegree) */ |
---|
180 | long lPole_lon; /* Longitude of pole of stretching */ |
---|
181 | long lStretch; /* Stretching factor */ |
---|
182 | }GDS_LATLON_INPUT; |
---|
183 | |
---|
184 | typedef struct GDS_PS_INPUT { /* Input: Polar Stereographic Grid */ |
---|
185 | unsigned short usData_type; /* Data representation type ( Table 6) */ |
---|
186 | unsigned short usNx; /* Nx - # of points along x-axis */ |
---|
187 | unsigned short usNy; /* Ny - # of points along y-axis */ |
---|
188 | long lLat1; /* Latitude of first grid point */ |
---|
189 | long lLon1; /* Longitude of first grid point */ |
---|
190 | unsigned short usRes_flag; /* Resolution and component flag (Table 7) */ |
---|
191 | long lLon_orient; /* Orientaion of grid - longitude */ |
---|
192 | unsigned long ulDx; /* X-direction grid length */ |
---|
193 | unsigned long ulDy; /* Y-direction grid length */ |
---|
194 | unsigned short usProj_flag; /* Projection center flag */ |
---|
195 | unsigned short usScan_mode; /* Scan mode */ |
---|
196 | unsigned short usZero; /* Reserved (set to 0) */ |
---|
197 | } GDS_PS_INPUT; |
---|
198 | |
---|
199 | typedef struct mercator /* mercator grids */ |
---|
200 | { |
---|
201 | unsigned short usData_type; /* Data representation type ( Table 6) */ |
---|
202 | int cols; /* Ni - Number of points along a latitude circle */ |
---|
203 | int rows; /* Nj - Number of points along a longitude meridian */ |
---|
204 | long first_lat; /* La1 - Latitude of first grid point */ |
---|
205 | long first_lon; /* Lo1 - Longitude of first grid point */ |
---|
206 | unsigned short usRes_flag; /* Resolution and component flag (Table 7)*/ |
---|
207 | long La2; /* latitude of last grid point, or # point / row */ |
---|
208 | long Lo2; /* longitude of last grid point, or # point / column */ |
---|
209 | long latin; /* Latin - the latitude at which the mercator |
---|
210 | projection intersects the earth */ |
---|
211 | unsigned short usZero1; /* Reserved (set to 0) */ |
---|
212 | unsigned short usScan_mode; /* Scanning mode (Table 8) */ |
---|
213 | float lon_inc; /* Di - the longitudinal direction increment |
---|
214 | (west to east) */ |
---|
215 | float lat_inc; /* Dj - the latitudinal direction increment |
---|
216 | (south to north) */ |
---|
217 | long usZero; /* Reserved (set to 0) */ |
---|
218 | }mercator; |
---|
219 | |
---|
220 | typedef struct BDS_HEAD_INPUT { /* BDS Header Input */ |
---|
221 | unsigned long length; /* BDS Length */ |
---|
222 | unsigned short usBDS_flag; /* BDS flag (Table 11) */ |
---|
223 | int Bin_sc_fctr; /* Binary scale factor */ |
---|
224 | float fReference; /* Reference value (minimum value) */ |
---|
225 | unsigned short usBit_pack_num; /* Number of bits into which data is packed*/ |
---|
226 | unsigned long ulGrid_size; /* Number of grid points */ |
---|
227 | float fPack_null; /* Pack_null value for packing data */ |
---|
228 | }BDS_HEAD_INPUT; |
---|
229 | |
---|
230 | typedef struct GDS_HEAD_INPUT { /* internal GDS Header Input */ |
---|
231 | unsigned short usNum_v; /* Number of vertical cords */ |
---|
232 | unsigned short usPl_Pv; /* PV or PL location */ |
---|
233 | unsigned short usData_type; /* Data representation type (Table 6) */ |
---|
234 | unsigned short uslength; /* GDS Length - depends on projection */ |
---|
235 | int *thin; /* array to hold sizes of thinned rows */ |
---|
236 | }GDS_HEAD_INPUT; |
---|
237 | |
---|
238 | typedef struct IDS_GRIB { /* IDS -Indicator Section 0 */ |
---|
239 | unsigned char szId[4]; /* "GRIB" Identifier */ |
---|
240 | unsigned char achTtl_length[3]; /* Total length of GRIB msg */ |
---|
241 | unsigned char chEd_num; /* GRIB Edition number - #1 */ |
---|
242 | } IDS_GRIB; |
---|
243 | |
---|
244 | typedef struct PDS_GRIB { /* PDS -Product Definition Section 1 */ |
---|
245 | unsigned char achPDS_length[3]; /* Section length (in octets) */ |
---|
246 | unsigned char chParm_tbl; /* Parameter table number (1) */ |
---|
247 | unsigned char chCenter_id; /* Id of originating center (Table 0) */ |
---|
248 | unsigned char chProc_id; /* Generating process Id number (Table A) */ |
---|
249 | unsigned char chGrid_id; /* Grid Identification (Table B) */ |
---|
250 | unsigned char chGds_bms_id; /* GDS and BMS flag (Table 1) */ |
---|
251 | unsigned char chParm_id; /* Parameter and unit id (Table 2) */ |
---|
252 | unsigned char chLevel_id; /* Type of level or layer id (Table 3/3a) */ |
---|
253 | unsigned char achHeight[2]; /* Height, pressure,etc of level (Table 3)*/ |
---|
254 | unsigned char chYear; /* Year of century -Initial or ref. */ |
---|
255 | unsigned char chMonth; /* Month of year -time of forecast */ |
---|
256 | unsigned char chDay; /* Day of month */ |
---|
257 | unsigned char chHour; /* Hour of day */ |
---|
258 | unsigned char chMinute; /* Minute of hour */ |
---|
259 | unsigned char chFcst_unit_id; /* Forecast time unit (Table 4) */ |
---|
260 | unsigned char chP1; /* Period of time (Number of time units) */ |
---|
261 | unsigned char chP2; /* Time interval between forecasts */ |
---|
262 | unsigned char chTime_range; /* Time range indicator (Table 5) */ |
---|
263 | unsigned char achTime_range_avg[2]; /* Number included in average if flag set */ |
---|
264 | unsigned char chTime_range_mis; /* Number missing from average */ |
---|
265 | unsigned char chCentury; /* Centry of Initial time (19) */ |
---|
266 | unsigned char chCenter_sub; /* Oct-26: Sub Center Id */ |
---|
267 | unsigned char achDec_sc_fctr[2]; /* Decimal scale factor */ |
---|
268 | unsigned char achZero[12]; /* Reserved */ |
---|
269 | |
---|
270 | /* WSI Extended PDS fields */ |
---|
271 | unsigned char PDS_41; /* Forecast time 1 unit id - Table 4 */ |
---|
272 | unsigned char PDS_42[4]; /* forecast time 1 (up to 4 bytes) */ |
---|
273 | unsigned char PDS_46; /* Forecast time 2 unit id - Table 4 */ |
---|
274 | unsigned char PDS_47[4]; /* forecast time 2 */ |
---|
275 | unsigned char PDS_51; /* Time range indicator - Table 5 */ |
---|
276 | unsigned char PDS_52[2]; /* Top of atmosphere--used with sigma coord*/ |
---|
277 | |
---|
278 | /* |
---|
279 | * The following was removed by Todd Hutchinson, WSI, 4/11/2002 |
---|
280 | * The extended pds section is now replaced with the values above |
---|
281 | */ |
---|
282 | /* unsigned char chExt_flag; Oct-41: Grib extensions usage flag*/ |
---|
283 | /* unsigned char chSecond; Second of Minute */ |
---|
284 | /* unsigned char chTrack_num[2]; Tracking ID for data set */ |
---|
285 | /* unsigned char chParm_sub; Sub-Table Entry for parameter and unit (Table 2) */ |
---|
286 | /* unsigned char chSub_tbl; Sub-Table Version number */ |
---|
287 | } PDS_GRIB; |
---|
288 | |
---|
289 | typedef struct GDS_HEAD { /* GDS header */ |
---|
290 | unsigned char achGDS_length[3]; /* Section length (in octets) */ |
---|
291 | unsigned char chNV; /* # of vertical coord. parameters (not used)*/ |
---|
292 | unsigned char chPV; /* Location of vert. coord., 255 if none */ |
---|
293 | unsigned char chData_type; /* Data representation type (Table 6) */ |
---|
294 | } GDS_HEAD; |
---|
295 | |
---|
296 | typedef struct LAMBERT { /* Lambert Conformal Grid */ |
---|
297 | unsigned char achNx[2]; /* Nx - # of points along x-axis */ |
---|
298 | unsigned char achNy[2]; /* Ny - # of points along y-axis */ |
---|
299 | unsigned char achLat1[3]; /* Latitude of first grid point */ |
---|
300 | unsigned char achLon1[3]; /* Longitude of first grid point */ |
---|
301 | unsigned char chRes_flag; /* Resolution and component flag (Table 7)*/ |
---|
302 | unsigned char achLon_orient[3]; /* Orientaion of grid - longitude */ |
---|
303 | unsigned char achDx[3]; /* X-direction grid length */ |
---|
304 | unsigned char achDy[3]; /* Y-direction grid length */ |
---|
305 | unsigned char chProj_flag; /* Projection center flag */ |
---|
306 | unsigned char chScan_mode; /* Scan mode */ |
---|
307 | unsigned char achLat_cut1[3]; /* First latitude which secant cone cuts */ |
---|
308 | unsigned char achLat_cut2[3]; /* Second latitude from pole */ |
---|
309 | unsigned char achLat_southpole[3]; /* Latitude of southern pole (millidegree)*/ |
---|
310 | unsigned char achLon_southpole[3]; /* Longitude of southern pole */ |
---|
311 | unsigned char achZero[2]; /* Reserved (set to 0) */ |
---|
312 | } LAMBERT; |
---|
313 | |
---|
314 | typedef struct POLAR { /* Polar Stereographic Grid */ |
---|
315 | unsigned char achNx[2]; /* Nx - # of points along x-axis */ |
---|
316 | unsigned char achNy[2]; /* Ny - # of points along y-ayis */ |
---|
317 | unsigned char achLat1[3]; /* Latitude of first grid point */ |
---|
318 | unsigned char achLon1[3]; /* Longitude of first grid point */ |
---|
319 | unsigned char chRes_flag; /* Resolution and component flag (Table 7) */ |
---|
320 | unsigned char achLon_orient[3]; /* Orientaion of grid - longitude */ |
---|
321 | unsigned char achDx[3]; /* X-direction grid length */ |
---|
322 | unsigned char achDy[3]; /* Y-direction grid length */ |
---|
323 | unsigned char chProj_flag; /* Projection center flag */ |
---|
324 | unsigned char chScan_mode; /* Scan mode */ |
---|
325 | unsigned char achZero[4]; /* Reserved (set to 0) */ |
---|
326 | } POLAR; |
---|
327 | |
---|
328 | typedef struct MERCATOR { /* Mercator Grid */ |
---|
329 | unsigned char achNi[2]; /* Ni - Number of points along latitude circle */ |
---|
330 | unsigned char achNj[2]; /* Nj - Number of points along longtitude meridian */ |
---|
331 | unsigned char achLat1[3]; /* Latitude of first grid point */ |
---|
332 | unsigned char achLon1[3]; /* Longtitude of first grid point */ |
---|
333 | unsigned char chRes_flag; /* Resolution and component flag (Table 7) */ |
---|
334 | unsigned char achLat2[3]; /* latitude of last grid point */ |
---|
335 | unsigned char achLon2[3]; /* longitude of last grid point */ |
---|
336 | unsigned char achLatin[3]; /* latitude(s) at which the Mercator projection |
---|
337 | cylinder intersects the earth */ |
---|
338 | unsigned char achZero1; /* Reserved (set to 0) */ |
---|
339 | unsigned char chScan_mode; /* Scan mode */ |
---|
340 | unsigned char achDi[3]; /* longitudinal direction increment (meters) */ |
---|
341 | unsigned char achDj[3]; /* latitudinal direction increment (meters) */ |
---|
342 | unsigned char achZero2[8]; /* Reserved (set to 0) */ |
---|
343 | } MERCATOR; |
---|
344 | |
---|
345 | typedef struct LATLON { /* Input: Latitude/Longitude Grid */ |
---|
346 | unsigned char achNi[2]; /* Number of points along a parallel */ |
---|
347 | unsigned char achNj[2] ; /* Number of points along a meridian */ |
---|
348 | unsigned char achLat1[3]; /* Latitude of first grid point */ |
---|
349 | unsigned char achLon1[3]; /* Longitude of first grid point */ |
---|
350 | unsigned char chRes_flag; /* Resolution and component flag (Table 7)*/ |
---|
351 | unsigned char achLat2[3]; /* Latitude of last grid point */ |
---|
352 | unsigned char achLon2[3]; /* Longitude of last grid point */ |
---|
353 | unsigned char achDi[2]; /* I-direction increment */ |
---|
354 | unsigned char achDj[2]; /* J-direction increment */ |
---|
355 | unsigned char chScan_mode; /* Scanning mode (Table 8) */ |
---|
356 | unsigned char achZero[4]; /* Reserved (set to 0) */ |
---|
357 | unsigned char achLat_southpole[3]; /* Latitude of southern pole (millidegree)*/ |
---|
358 | unsigned char achLon_southpole[3]; /* Longitude of southern pole */ |
---|
359 | unsigned char achRotate[4]; /* Angle of rotation */ |
---|
360 | unsigned char achPole_lat[3]; /* Latitude of pole of stretching (millidegree) */ |
---|
361 | unsigned char achPole_lon[3]; /* Longitude of pole of stretching */ |
---|
362 | unsigned char achStretch[4]; /* Stretching factor */ |
---|
363 | } LATLON; |
---|
364 | |
---|
365 | typedef struct BDS_HEAD { /* Binary Data Section 4 */ |
---|
366 | unsigned char achBDS_length[3]; /* Section length */ |
---|
367 | unsigned char chBDS_flag; /* Flag (Table 11) */ |
---|
368 | unsigned char achBin_sc_fctr[2]; /* Binary Scale Factor */ |
---|
369 | unsigned char achReference[4]; /* Reference value (minimum value)IBM format*/ |
---|
370 | unsigned char chBit_pack_num; /* Number of bits into which data is packed*/ |
---|
371 | } BDS_HEAD; |
---|
372 | |
---|
373 | typedef struct EDS_GRIB { /* End Section 5 */ |
---|
374 | unsigned char szEDS_id[4]; /* "7777" Ascii characters */ |
---|
375 | } EDS_GRIB; |
---|
376 | |
---|
377 | typedef struct grid_desc_sec /* Grid Description Section */ |
---|
378 | { |
---|
379 | struct GDS_HEAD_INPUT head; /* GDS Header section - common to all */ |
---|
380 | struct GDS_LATLON_INPUT llg; /* Latitude/Longitude or Gaussian grids */ |
---|
381 | struct GDS_LAM_INPUT lam; /* lambert conformal grids */ |
---|
382 | struct GDS_PS_INPUT pol; /* polar stereographic grids */ |
---|
383 | struct mercator merc; /* mercator grids */ |
---|
384 | }grid_desc_sec; |
---|
385 | |
---|
386 | typedef struct BMS_GRIB /* Bit Map Section 3 */ |
---|
387 | { |
---|
388 | unsigned char achBMS_length[3]; /* Section length */ |
---|
389 | unsigned char chUnused_bits; /* #unused bits in bitmap stream */ |
---|
390 | unsigned char achBMS_id[2]; /* 0 or a predefined bitmap id */ |
---|
391 | } BMS_GRIB; |
---|
392 | |
---|
393 | typedef struct BMS_INPUT /* User Input structure - BMS */ |
---|
394 | { |
---|
395 | unsigned long uslength; /* section length */ |
---|
396 | unsigned short usUnused_bits; /* number of Unused bits */ |
---|
397 | unsigned short usBMS_id; /* 0 or a predefined id */ |
---|
398 | unsigned long ulbits_set; /* num of datapts present */ |
---|
399 | char *bit_map; /* pts to beg. of BM bstream */ |
---|
400 | } BMS_INPUT; |
---|
401 | |
---|