Update version info for release v4.6.1 (#2122)
[WRF.git] / external / io_grib1 / MEL_grib1 / gribgetgds.c
blobe667b9142e8180b9ccd582e02673e33c2950b395
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "dprints.h" /* for dprints & func prototypes */
4 #include "gribfuncs.h" /* prototypes */
5 /*
6 REVISION/MODIFICATION HISTORY:
7 03/07/94 written by Mugur Georgescu CSC, Monterey CA
8 02/01/96 modified by Steve Lowe SAIC, Monterey CA
9 06/19/96 modified by Alice Nakajima SAIC, Monterey CA
10 10/15/97/ATN init usData_type in Projection struct too
11 02/18/98/atn replace projection ids with constants
13 *******************************************************************
14 * A. FUNCTION gribgetgds
15 * Decode the Grid Description Section (GDS) from the provided
16 * pointer location and store its the in the internal GDS structure;
18 * INTERFACE:
19 * int gribgetgds (curr_ptr, gds, errmsg)
21 * ARGUMENTS (I=input, O=output, I&O=input and output):
22 * (I) char *curr_ptr; points to 1st octet of GDS
23 * (O) grid_desc_sec *gds; internal GDS structure to be filled
24 * (O) char *errmsg; returned filled if error occurred
26 * RETURN CODE:
27 * 0> success, struct grid_desc_sec filled;
28 * 1> unsupported projection number, errmsg filled;
29 * 2> section length too short, errmsg filled;
30 *******************************************************************
33 #if PROTOTYPE_NEEDED
34 int gribgetgds ( char *curr_ptr, grid_desc_sec *gds, char *errmsg)
35 #else
36 int gribgetgds ( curr_ptr, gds, errmsg)
37 char *curr_ptr;
38 grid_desc_sec *gds;
39 char *errmsg;
40 #endif
42 char *func= "gribgetgds";
43 char *in = curr_ptr; /* pointer to the message */
44 unsigned long skip; /* bits to be skipped */
45 unsigned long something; /* value extracted from message */
46 int sign; /* sign + or - */
47 int status;
48 FILE *fp;
49 int i;
51 DPRINT1 ("Entering %s\n", func);
54 * A.0 INIT status to good, skip to 0
56 status=0; skip=0;
59 * A.1 FUNCTION gbyte !GDS length
60 * IF (length < 32 bytes) THEN
61 * SET error status of 2 !length too short
62 * CONTINUE to load as much info as possible into
63 * structure 'grid_desc_sec' but will return with error
64 * ENDIF
66 gbyte(in,&something,&skip,24); DPRINT0 ("gds->head.uslength\n");
67 gds->head.uslength = (unsigned short) something;
68 if (gds->head.uslength < 32) {
69 sprintf(errmsg,
70 "GDS length too short (%ld). Will attempt to load struct grid_desc_sec\n",
71 gds->head.uslength);
72 status = 2; /* corrupt length */
75 /*
77 * A.2 FUNCTION gbyte !parm_nv
79 gbyte(in,&something,&skip,8); DPRINT0 ("gds->head.usNum_v\n");
80 gds->head.usNum_v =(short) something;
81 /*
83 * A.3 FUNCTION gbyte !parm_pv_pl
85 gbyte(in,&something,&skip,8); DPRINT0 ("gds->head.usPl_Pv\n");
86 gds->head.usPl_Pv = (short) something;
88 /*
90 * A.4 FUNCTION gbyte !data representation type
92 gbyte(in,&something,&skip,8); DPRINT0 ("gds->head.usData_type\n");
93 gds->head.usData_type = (short) something;
95 /* Remainder of GDS is projection dependent */
98 * A.5 SWITCH (data type)
101 switch(gds->head.usData_type)
103 case LATLON_PRJ: /* Lat/Lon Grid */
104 case GAUSS_PRJ: /* Gaussian Latitude/Longitude grid */
105 case ROT_LATLON_PRJ: /* Rotated Lat/Lon */
106 case ROT_GAUSS_PRJ: /* Rotated Gaussian */
107 case STR_LATLON_PRJ: /* Stretched Lat/Lon */
108 case STR_GAUSS_PRJ : /* Stretched Gaussian */
109 case STR_ROT_LATLON_PRJ : /* Stretched and Rotated Lat/Lon */
110 case STR_ROT_GAUSS_PRJ : /* Stretched and Rotated Gaussian */
112 * case latlon:
113 * case gaussian_latlon:
114 * case rotated gaussian:
115 * case stretched latlon:
116 * case stretched gaussian:
117 * case stretched & rotated latlon:
118 * case stretched & rotated gaussian:
119 * Mark the Projection type
120 * FUNCTION gbyte !get Number of Columns
122 gds->llg.usData_type = gds->head.usData_type;
124 gbyte(in, &something, &skip, 16);
125 DPRINT0 ("gds->llg.usNi\n");
126 gds->llg.usNi = (int) something; /* get Ni */
129 * FUNCTION gbyte !get Number of Rows
131 gbyte(in, &something, &skip, 16);
132 DPRINT0 ("gds->llg.usNj\n");
133 gds->llg.usNj = (int) something; /* get Nj */
136 * FUNCTION gbyte !get Latitude of First point
138 gbyte(in,&something,&skip,24);
139 DPRINT0 ("Sign & gds->llg.lLat1 \n");
140 sign = (int)(something >> 23) & 1; /* get sign */
141 gds->llg.lLat1 = (long) (something) & 8388607; /* get La1 */
142 if(sign) /* negative value */
143 gds->llg.lLat1 = - gds->llg.lLat1; /* multiply by -1 */
146 * FUNCTION gbyte !get Longitude of First point
148 gbyte(in,&something,&skip,24);
149 DPRINT0 ("Sign & gds->llg.lLon1 \n");
150 sign = (int)(something >> 23) & 1; /* get sign */
151 gds->llg.lLon1 = (long) (something) & 8388607; /* get Lo1 */
152 if(sign) /* negative value */
153 gds->llg.lLon1 = - gds->llg.lLon1; /* multiply by -1 */
156 * FUNCTION gbyte !get resolution & comp flags
158 gbyte(in,&something,&skip,8);
159 DPRINT0 ("gds->llg.usRes_flag\n");
160 gds->llg.usRes_flag = (short) something; /* get resolution & comp flags */
162 gbyte(in,&something,&skip,24);
163 DPRINT0 ("Sign & gds->llg.lLat2 \n");
165 * FUNCTION gbyte !get Latitude of Last point
167 sign = (int)(something >> 23) & 1; /* get sign */
168 gds->llg.lLat2 = (long) (something) & 8388607; /* get La2 */
169 if(sign) /* negative value */
170 gds->llg.lLat2 = - gds->llg.lLat2; /* multiply by -1 */
173 * FUNCTION gbyte !get Longitude of Last point
175 gbyte(in,&something,&skip,24);
176 DPRINT0 ("Sign & gds->llg.lLon2 \n");
177 sign = (int)(something >> 23) & 1; /* get sign */
178 gds->llg.lLon2 = (long) (something) & 8388607; /* get Lo2 */
179 if(sign) /* negative value */
180 gds->llg.lLon2 = - gds->llg.lLon2; /* multiply by -1 */
183 * FUNCTION gbyte !get Longitudinal Increment
185 gbyte(in,&something,&skip,16);
186 DPRINT0 ("gds->llg.iDi\n");
187 gds->llg.iDi = (int) something; /* get Di */
190 * FUNCTION gbyte !get Latitudinal Increment
192 gbyte(in,&something,&skip,16);
193 DPRINT0 ("gds->llg.iDj\n");
194 gds->llg.iDj = (int) something; /* get Dj */
197 * FUNCTION gbyte !get scanning mode
199 gbyte(in,&something,&skip,8);
200 DPRINT0 ("gds->llg.usScan_mode\n");
201 gds->llg.usScan_mode = (short) something; /* get scaning mode flag */
204 * FUNCTION gbyte !get reserved octets 29-32
206 gbyte(in,&something,&skip,32);
207 DPRINT0 ("gds->llg.usZero\n");
208 gds->llg.usZero = (long) something; /* get reserved octets 29 - 32 */
210 if (gds->head.usNum_v > 0) {
212 * FUNCTION gbyte !get south pole lat
214 gbyte(in,&something,&skip,24);
215 DPRINT0 ("Sign & gds->llg.lLat_southpole \n");
216 sign = (int)(something >> 23) & 1; /* get sign */
217 gds->llg.lLat_southpole = (long)(something) & 8388607; /* southpole lat*/
218 if(sign) /* negative value */
219 gds->llg.lLat_southpole = - gds->llg.lLat_southpole; /* multiply -1 */
222 * FUNCTION gbyte !get south pole lon
224 gbyte(in,&something,&skip,24);
225 DPRINT0 ("Sign & gds->llg.lLon_southpole \n");
226 sign = (int)(something >> 23) & 1; /* get sign */
227 gds->llg.lLon_southpole =(long)(something) & 8388607; /* southpole lon*/
228 if(sign) /* negative value , multiply by -1 */
229 gds->llg.lLon_southpole = - gds->llg.lLon_southpole;
232 * FUNCTION gbyte !angle of rotation
234 gbyte(in,&something,&skip,24);
235 DPRINT0 ("gds->llg.lRotate\n");
236 gds->llg.lRotate = (long) something; /* get angle of rotation */
239 * FUNCTION gbyte !get lat pole stretching
241 gbyte(in,&something,&skip,24);
242 DPRINT0 ("Sign & gds->llg.lPole_lat \n");
243 sign = (int)(something >> 23) & 1; /* get sign */
244 gds->llg.lPole_lat = (long)something & 8388607; /* lat pole stretching */
245 if(sign) /* negative value */
246 gds->llg.lPole_lat = - gds->llg.lPole_lat; /* multiply by -1 */
249 * FUNCTION gbyte !get lon pole stretching
251 gbyte(in,&something,&skip,24);
252 DPRINT0 ("Sign & gds->llg.lPole_lon \n");
253 sign = (int)(something >> 23) & 1; /* get sign */
254 gds->llg.lPole_lon= (long)(something) & 8388607; /* lon pole stretching*/
255 if(sign) /* negative value */
256 gds->llg.lPole_lon = - gds->llg.lPole_lon; /* multiply by -1 */
258 gbyte(in,&something,&skip,24);
259 DPRINT0 ("gds->llg.lStretch\n");
260 gds->llg.lStretch = (long) something;
264 * FUNCTION gbyte !get number of columns in each row
266 if (gds->llg.usNi == 65535) {
267 if (gds->head.thin == NULL) {
268 gds->head.thin = (int *)malloc(gds->llg.usNj*sizeof(int));
269 } else {
270 gds->head.thin = (int *)realloc(gds->head.thin,
271 gds->llg.usNj*sizeof(int));
273 if (gds->head.thin == NULL) {
274 sprintf(errmsg,
275 "%s: failed to create array[%d] for thinned grid information",
276 func, gds->head.thin);
277 goto BYE;
279 for (i = 0; i<gds->llg.usNj; i++) {
280 gbyte(in,&something,&skip,16);
281 gds->head.thin[i] = (short)something;
283 } else {
284 gds->head.thin = NULL;
286 break;
288 case MERC_PRJ: /* Mercator Projection Grid */
290 * case Mercator Projection Grid:
291 * Mark the Projection type
292 * FUNCTION gbyte !get Number of Columns
294 gds->merc.usData_type = gds->head.usData_type;
296 gbyte(in,&something,&skip,16);
297 DPRINT0 ("gds->merc.cols\n");
298 gds->merc.cols = (int) something; /* get Ni */
300 * FUNCTION gbyte !get Number of Rows
302 gbyte(in,&something,&skip,16);
303 DPRINT0 ("gds->merc.rows\n");
304 gds->merc.rows = (int) something; /* get Nj */
307 * FUNCTION gbyte !get Latitude of First Point
309 gbyte(in,&something,&skip,24);
310 DPRINT0 ("Sign & gds->merc.first_lat\n");
311 sign = (int)(something >> 23) & 1; /* get sign */
312 gds->merc.first_lat = (long) (something) & 8388607; /* get La1 */
313 if(sign) /* negative value */
314 gds->merc.first_lat = - gds->merc.first_lat; /* multiply by -1 */
317 * FUNCTION gbyte !get Longitude of First Point
319 gbyte(in,&something,&skip,24);
320 DPRINT0 ("Sign & gds->merc.first_lon\n");
321 sign = (int)(something >> 23) & 1; /* get sign */
322 gds->merc.first_lon = (long) (something) & 8388607; /* get Lo1 */
323 if(sign) /* negative value */
324 gds->merc.first_lon = - gds->merc.first_lon; /* multiply by -1 */
327 * FUNCTION gbyte !get resolution & comp flag
329 gbyte(in,&something,&skip,8);
330 DPRINT0 ("gds->merc.usRes_flag\n");
331 gds->merc.usRes_flag = (short) something; /* resolution & comp flags */
334 * FUNCTION gbyte !get Latitude of Last point
336 gbyte(in,&something,&skip,24);
337 DPRINT0 ("Sign & gds->merc.La2\n");
338 sign = (int)(something >> 23) & 1; /* get sign */
339 gds->merc.La2 = (long) (something) & 8388607; /* get La2 */
340 if(sign) /* negative value */
341 gds->merc.La2 = - gds->merc.La2; /* multiply by -1 */
344 * FUNCTION gbyte !get Longitude of Last point
346 gbyte(in,&something,&skip,24);
347 DPRINT0 ("Sign & gds->merc.Lo2\n");
348 sign = (int)(something >> 23) & 1; /* get sign */
349 gds->merc.Lo2 = (long) (something) & 8388607; /* get Lo2 */
350 if(sign) /* negative value */
351 gds->merc.Lo2 = - gds->merc.Lo2; /* multiply by -1 */
354 * FUNCTION gbyte !get Latitude where projection intersects Earth
356 gbyte(in,&something,&skip,24);
357 DPRINT0 ("Sign & gds->merc.latin\n");
358 sign = (int)(something >> 23) & 1; /* get sign */
359 gds->merc.latin = (long) (something) & 8388607; /* get latin */
360 if(sign) /* negative value */
361 gds->merc.latin = - gds->merc.latin; /* multiply by -1 */
363 skip += 8; /* skip over the reserved octet */
366 * FUNCTION gbyte !get scanning mode flag
368 gbyte(in,&something,&skip,8);
369 DPRINT0 ("gds->merc.usScan_mode\n");
370 gds->merc.usScan_mode = (short) something; /* get scaning mode flag */
373 * FUNCTION gbyte !get Longitudinal Increment
375 gbyte(in,&something,&skip,24);
376 DPRINT0 ("gds->merc.lon_inc\n");
377 gds->merc.lon_inc = (float) something; /* get Di */
380 * FUNCTION gbyte !get Latitudinal Increment
382 gbyte(in,&something,&skip,24);
383 DPRINT0 ("gds->merc.lat_inc\n");
384 gds->merc.lat_inc = (float) something; /* get Dj */
386 gbyte(in,&something,&skip,32);
387 DPRINT0 ("gds->merc.usZero\n");
388 gds->merc.usZero = (long) something;
390 if (gds->merc.cols == 65535) {
391 gds->head.thin = (int *)calloc(gds->merc.rows,sizeof(int));
392 if (gds->head.thin == NULL) {
393 sprintf(errmsg,
394 "%s: failed to create array[%d] for thinned grid information",
395 func, gds->head.thin);
396 goto BYE;
398 for (i = 0; i<gds->merc.rows; i++) {
399 gbyte(in,&something,&skip,16);
400 gds->head.thin[i] = (short)something;
402 } else {
403 gds->head.thin = NULL;
406 break;
408 case POLAR_PRJ: /* Polar Stereographic Projection Grid */
410 * case Polar Stereographic Projection Grid:
411 * Mark the Projection type
412 * FUNCTION gbyte !get Number of Columns
414 gds->pol.usData_type = gds->head.usData_type;
416 gbyte(in,&something,&skip,16);
417 DPRINT0 ("gds->pol.usNx\n");
418 gds->pol.usNx = (short) something; /* get Nx */
421 * FUNCTION gbyte !get Number of Rows
423 gbyte(in,&something,&skip,16);
424 DPRINT0 ("gds->pol.usNy\n");
425 gds->pol.usNy = (short) something; /* get Ny */
428 * FUNCTION gbyte !get Latitude of First point
430 gbyte(in,&something,&skip,24);
431 DPRINT0 ("Sign & gds->pol.lLat1\n");
432 sign = (int)(something >> 23) & 1; /* get sign */
433 gds->pol.lLat1 = (long) (something) & 8388607; /* get La1 */
434 if(sign) /* negative value */
435 gds->pol.lLat1 = - gds->pol.lLat1; /* multiply by -1 */
438 * FUNCTION gbyte !get Longitude of First point
440 gbyte(in,&something,&skip,24);
441 DPRINT0 ("Sign & gds->pol.lLon1\n");
442 sign = (int)(something >> 23) & 1; /* get sign */
443 gds->pol.lLon1 = (long) (something) & 8388607; /* get Lo1 */
444 if(sign) /* negative value */
445 gds->pol.lLon1 = - gds->pol.lLon1; /* multiply by -1 */
448 * FUNCTION gbyte !get resolution & comp flag
450 gbyte(in,&something,&skip,8);
451 DPRINT0 ("gds->pol.usRes_flag\n");
452 gds->pol.usRes_flag = (short) something; /* get resolution & comp flags */
455 * FUNCTION gbyte !get Orientation Longitude
457 gbyte(in,&something,&skip,24);
458 DPRINT0 ("Sign & gds->pol.lLon_orient\n");
459 sign = (int)(something >> 23) & 1; /* get sign */
460 gds->pol.lLon_orient = (long) (something) & 8388607; /* Orientation */
461 if(sign) /* negative value , multiply by -1 */
462 gds->pol.lLon_orient = - gds->pol.lLon_orient;
465 * FUNCTION gbyte !get Increment along a Row
467 gbyte(in,&something,&skip,24);
468 DPRINT0 ("gds->pol.ulDx\n");
469 gds->pol.ulDx = (float) something; /* get Dx */
472 * FUNCTION gbyte !get Increment along a Column
474 gbyte(in,&something,&skip,24);
475 DPRINT0 ("gds->pol.ulDy\n");
476 gds->pol.ulDy = (float) something; /* get Dy */
479 * FUNCTION gbyte !get projection center flag
481 gbyte(in,&something,&skip,8);
482 DPRINT0 ("gds->pol.usProj_flag\n");
483 gds->pol.usProj_flag = (short) something; /* Projection center flag */
486 * FUNCTION gbyte !get scanning mode
488 gbyte(in,&something,&skip,8);
489 DPRINT0 ("gds->pol.usScan_mode\n");
490 gds->pol.usScan_mode = (short) something; /* get scaning mode flag */
493 * FUNCTION gbyte !reserved zero
495 gbyte(in,&something,&skip,32);
496 DPRINT0 ("gds->pol.usZero\n");
497 gds->pol.usZero = (int) something; /* get Reserved zero */
499 if (gds->pol.usNx == 65535) {
500 gds->head.thin = (int *)calloc(gds->pol.usNy,sizeof(int));
501 if (gds->head.thin == NULL) {
502 sprintf(errmsg,
503 "%s: failed to create array[%d] for thinned grid information",
504 func, gds->head.thin);
505 goto BYE;
507 for (i = 0; i<gds->pol.usNy; i++) {
508 gbyte(in,&something,&skip,16);
509 gds->head.thin[i] = (short)something;
511 } else {
512 gds->head.thin = NULL;
515 break;
517 case LAMB_PRJ: /* Lambert Conformal */
518 case ALBERS_PRJ: /* Albers equal-area */
519 case OBLIQ_LAMB_PRJ: /* Oblique Lambert Conformal */
521 * case Lambert conformal, secant or tangent, conical or bipolar:
522 * case Albers equal-area, secant or tangent, conical or bipolar:
523 * case Oblique Lambert conformal:
524 * Mark the Projection type
525 * FUNCTION gbyte !get Number of Columns
527 gds->lam.usData_type = gds->head.usData_type;
529 gbyte(in,&something,&skip,16);
530 DPRINT0 ("gds->lam.iNx\n");
531 gds->lam.iNx = (int) something; /* get Nx */
534 * FUNCTION gbyte !get Number of Rows
536 gbyte(in,&something,&skip,16);
537 DPRINT0 ("gds->lam.iNy\n");
538 gds->lam.iNy = (int) something; /* get Ny */
541 * FUNCTION gbyte !get Latitude of First Point
543 gbyte(in,&something,&skip,24);
544 DPRINT0 ("Sign & gds->lam.lLat1\n");
545 sign = (int)(something >> 23) & 1; /* get sign */
546 gds->lam.lLat1 = (long) (something) & 8388607; /* get La1 */
547 if(sign) /* negative value */
548 gds->lam.lLat1 = - gds->lam.lLat1; /* multiply by -1 */
551 * FUNCTION gbyte !get Longitude of First Point
553 gbyte(in,&something,&skip,24);
554 DPRINT0 ("Sign & gds->lam.lLon1)\n");
555 sign = (int)(something >> 23) & 1; /* get sign */
556 gds->lam.lLon1 = (long) (something) & 8388607; /* get Lo1 */
557 if(sign) /* negative value */
558 gds->lam.lLon1 = - gds->lam.lLon1; /* multiply by -1 */
561 * FUNCTION gbyte !get resolution & comp flag
563 gbyte(in,&something,&skip,8);
564 DPRINT0 ("gds->lam.usRes_flag\n");
565 gds->lam.usRes_flag = (short) something; /* resolution & comp flags */
568 * FUNCTION gbyte !get Orientation Longitude
570 gbyte(in,&something,&skip,24);
571 DPRINT0 ("Sign & gds->lam.lLon_orient)\n");
572 sign = (int)(something >> 23) & 1; /* get sign */
573 gds->lam.lLon_orient = (long) (something) & 8388607; /* Orientation */
574 if(sign) /* negative value , multiply by -1 */
575 gds->lam.lLon_orient = - gds->lam.lLon_orient;
578 * FUNCTION gbyte !get Increment along a Row
580 gbyte(in,&something,&skip,24);
581 DPRINT0 ("gds->lam.ulDx\n");
582 gds->lam.ulDx = (float) something; /* get Dx */
585 * FUNCTION gbyte !get Increment along a Column
587 gbyte(in,&something,&skip,24);
588 DPRINT0 ("gds->lam.ulDy\n");
589 gds->lam.ulDy = (float) something; /* get Dy */
592 * FUNCTION gbyte !get Projection Center
594 gbyte(in,&something,&skip,8);
595 DPRINT0 ("gds->lam.usProj_flag\n");
596 gds->lam.usProj_flag= (short) something; /* Projection center flag */
599 * FUNCTION gbyte !get scanning mode flag
601 gbyte(in,&something,&skip,8);
602 DPRINT0 ("gds->usScan_mode\n");
603 gds->lam.usScan_mode = (short) something; /* get scaning mode flag */
606 * FUNCTION gbyte !get First lat from pole that intersects Earth
608 gbyte(in,&something,&skip,24);
609 DPRINT0 ("gds->lLat_cut1\n");
610 gds->lam.lLat_cut1 = (long) something; /* get latin_1 */
613 * FUNCTION gbyte !get Second lat from pole that intersects Earth
615 gbyte(in,&something,&skip,24);
616 DPRINT0 ("gds->lLat_cut2\n");
617 gds->lam.lLat_cut2 = (long) something; /* get latin_2 */
620 * FUNCTION gbyte !get lat of south pole
622 gbyte(in,&something,&skip,24);
623 DPRINT0 ("Sign & gds->lLat_southpole\n");
624 sign = (int)(something >> 23) & 1; /* get sign */
625 gds->lam.lLat_southpole = (long) (something) & 8388607; /* lat S.pole*/
626 if(sign) /* negative value , multiply by -1 */
627 gds->lam.lLat_southpole = - gds->lam.lLat_southpole;
630 * FUNCTION gbyte !get lon of South pole
632 gbyte(in,&something,&skip,24);
633 DPRINT0 ("Sign & gds->lLon_southpole\n");
634 sign = (int)(something >> 23) & 1; /* get sign */
635 gds->lam.lLon_southpole = (long) (something) & 8388607;/* lon S.pole */
636 if(sign) /* negative value, multiply by -1 */
637 gds->lam.lLon_southpole = - gds->lam.lLon_southpole;
640 * FUNCTION gbyte !get Reserved zero
642 gbyte(in,&something,&skip,16);
643 DPRINT0 ("gds->lam.usZero\n");
644 gds->lam.usZero = (int) something; /* Reserved zero */
646 gds->head.thin = NULL;
648 if (gds->lam.iNx == 65535) {
649 gds->head.thin = (int *)calloc(gds->lam.iNy,sizeof(int));
650 if (gds->head.thin == NULL) {
651 sprintf(errmsg,
652 "%s: failed to create array[%d] for thinned grid information",
653 func, gds->head.thin);
654 goto BYE;
656 for (i = 0; i<gds->lam.iNy; i++) {
657 gbyte(in,&something,&skip,16);
658 gds->head.thin[i] = (short)something;
660 } else {
661 gds->head.thin = NULL;
664 break;
666 default : /* other cases not implemented in this version */
668 * default: ! unsupported data types
669 * SET Status to bad
671 DPRINT2 ("%s: unknown datatype=%d\n",func, gds->head.usData_type);
672 sprintf(errmsg,"%s: unknown datatype=%d\n",func, gds->head.usData_type);
673 status=1; /* set status to failure */
674 break;
677 * A.5 ENDSWITCH
679 } /* end switch on data type */
683 * A.6 DEBUG Print
685 * A.7 RETURN (status)
687 BYE:
688 DPRINT2 ("Exiting %s, stat=%d\n", func,status);
689 return(status);
691 * END OF FUNCTION