stream_grb.c 14.7 KB
Newer Older
1
#ifdef HAVE_CONFIG_H
2
#include "config.h"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
3
4
5
#endif

#include "cdi.h"
6
#include "cdi_int.h"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
7
#include "stream_cgribex.h"
8
#include "stream_grb.h"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
9
10
11
#include "stream_gribapi.h"
#include "file.h"
#include "cgribex.h"  /* gribZip gribGetZip gribGinfo */
12
13
14


// Regarding operation to change parameter identification:
15
16
// change if cdiGribChangeParameterID.active
struct cdiGribParamChange cdiGribChangeParameterID;
17

18
// Used only for CDO module Selmulti
19
20
21
22
23
void streamGrbChangeParameterIdentification(int code, int ltype, int lev)
{
  // NOTE this is a "PROXY" function for gribapiChangeParameterIdentification();
  // This just sets the globals. There are probably better solutions to this.
  // The parameter change is done by function  gribapiChangeParameterIdentification() in stream_gribapi.c
24
25
26
27
28
29
  // Setting this control variable to true will cause calling fnc. gribapiChangeParameterIdentification later.
  // After grib attributes have been changed this variable goes to false.
  cdiGribChangeParameterID.active = true;
  cdiGribChangeParameterID.code = code;
  cdiGribChangeParameterID.ltype = ltype;
  cdiGribChangeParameterID.lev = lev;
30
}
31

32
33
34
35
36
37
38
39
40
struct cdiGribModeChange cdiGribChangeModeUvRelativeToGrid;

// Used only for CDO module WindTrans
void streamGrbChangeModeUvRelativeToGrid(int mode)
{
  cdiGribChangeModeUvRelativeToGrid.active = true;
  cdiGribChangeModeUvRelativeToGrid.mode = (mode > 0);
}

41
42
43
44
45
46
47
48
49
50
51
52
53
struct cdiGribScanModeChange cdiGribDataScanningMode;

void streamGrbDefDataScanningMode(int scanmode)
{
  cdiGribDataScanningMode.active = true;
  cdiGribDataScanningMode.scanmode = scanmode;
}

int  streamGrbInqDataScanningMode(void)
{
  return cdiGribDataScanningMode.scanmode;
}

54

55
56
57
58
59
60
int grib1ltypeToZaxisType(int grib_ltype)
{
  int zaxistype = ZAXIS_GENERIC;

  switch ( grib_ltype )
    {
61
62
63
64
65
66
67
68
    case GRIB1_LTYPE_SURFACE:            zaxistype = ZAXIS_SURFACE;                break;
    case GRIB1_LTYPE_CLOUD_BASE:         zaxistype = ZAXIS_CLOUD_BASE;             break;
    case GRIB1_LTYPE_CLOUD_TOP:          zaxistype = ZAXIS_CLOUD_TOP;              break;
    case GRIB1_LTYPE_ISOTHERM0:          zaxistype = ZAXIS_ISOTHERM_ZERO;          break;
    case GRIB1_LTYPE_TOA:                zaxistype = ZAXIS_TOA;                    break;
    case GRIB1_LTYPE_SEA_BOTTOM:         zaxistype = ZAXIS_SEA_BOTTOM;             break;
    case GRIB1_LTYPE_ATMOSPHERE:         zaxistype = ZAXIS_ATMOSPHERE;             break;
    case GRIB1_LTYPE_MEANSEA:            zaxistype = ZAXIS_MEANSEA;                break;
69
    case GRIB1_LTYPE_99:
70
    case GRIB1_LTYPE_ISOBARIC_PA:
71
72
73
    case GRIB1_LTYPE_ISOBARIC:           zaxistype = ZAXIS_PRESSURE;               break;
    case GRIB1_LTYPE_HEIGHT:             zaxistype = ZAXIS_HEIGHT;                 break;
    case GRIB1_LTYPE_ALTITUDE:           zaxistype = ZAXIS_ALTITUDE;	           break;
Deike Kleberg's avatar
Deike Kleberg committed
74
    case GRIB1_LTYPE_SIGMA:
75
    case GRIB1_LTYPE_SIGMA_LAYER:        zaxistype = ZAXIS_SIGMA;	           break;
76
    case GRIB1_LTYPE_HYBRID:
77
    case GRIB1_LTYPE_HYBRID_LAYER:       zaxistype = ZAXIS_HYBRID;	           break;
78
    case GRIB1_LTYPE_LANDDEPTH:
79
80
81
82
83
84
85
86
    case GRIB1_LTYPE_LANDDEPTH_LAYER:    zaxistype = ZAXIS_DEPTH_BELOW_LAND;       break;
    case GRIB1_LTYPE_ISENTROPIC:         zaxistype = ZAXIS_ISENTROPIC;             break;
    case GRIB1_LTYPE_SEADEPTH:           zaxistype = ZAXIS_DEPTH_BELOW_SEA;        break;
    case GRIB1_LTYPE_LAKE_BOTTOM:        zaxistype = ZAXIS_LAKE_BOTTOM;            break;
    case GRIB1_LTYPE_SEDIMENT_BOTTOM:    zaxistype = ZAXIS_SEDIMENT_BOTTOM;        break;
    case GRIB1_LTYPE_SEDIMENT_BOTTOM_TA: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;     break;
    case GRIB1_LTYPE_SEDIMENT_BOTTOM_TW: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;     break;
    case GRIB1_LTYPE_MIX_LAYER:          zaxistype = ZAXIS_MIX_LAYER;              break;
87
88
    }

89
  return zaxistype;
90
91
92
93
94
95
96
97
98
}


int grib2ltypeToZaxisType(int grib_ltype)
{
  int zaxistype = ZAXIS_GENERIC;

  switch ( grib_ltype )
    {
99
100
101
102
103
104
105
106
107
108
109
110
    case GRIB2_LTYPE_SURFACE:            zaxistype = ZAXIS_SURFACE;                break;
    case GRIB2_LTYPE_CLOUD_BASE:         zaxistype = ZAXIS_CLOUD_BASE;             break;
    case GRIB2_LTYPE_CLOUD_TOP:          zaxistype = ZAXIS_CLOUD_TOP;              break;
    case GRIB2_LTYPE_ISOTHERM0:          zaxistype = ZAXIS_ISOTHERM_ZERO;          break;
    case GRIB2_LTYPE_TOA:                zaxistype = ZAXIS_TOA;                    break;
    case GRIB2_LTYPE_SEA_BOTTOM:         zaxistype = ZAXIS_SEA_BOTTOM;             break;
    case GRIB2_LTYPE_ATMOSPHERE:         zaxistype = ZAXIS_ATMOSPHERE;             break;
    case GRIB2_LTYPE_MEANSEA:            zaxistype = ZAXIS_MEANSEA;                break;
    case GRIB2_LTYPE_ISOBARIC:           zaxistype = ZAXIS_PRESSURE;               break;
    case GRIB2_LTYPE_HEIGHT:             zaxistype = ZAXIS_HEIGHT;                 break;
    case GRIB2_LTYPE_ALTITUDE:           zaxistype = ZAXIS_ALTITUDE;               break;
    case GRIB2_LTYPE_SIGMA:              zaxistype = ZAXIS_SIGMA;                  break;
111
    case GRIB2_LTYPE_HYBRID:
112
 /* case GRIB2_LTYPE_HYBRID_LAYER: */    zaxistype = ZAXIS_HYBRID;                 break;
113
    case GRIB2_LTYPE_LANDDEPTH:
114
115
116
117
118
119
120
121
122
123
 /* case GRIB2_LTYPE_LANDDEPTH_LAYER: */ zaxistype = ZAXIS_DEPTH_BELOW_LAND;       break;
    case GRIB2_LTYPE_ISENTROPIC:         zaxistype = ZAXIS_ISENTROPIC;             break;
    case GRIB2_LTYPE_SNOW:               zaxistype = ZAXIS_SNOW;                   break;
    case GRIB2_LTYPE_SEADEPTH:           zaxistype = ZAXIS_DEPTH_BELOW_SEA;        break;
    case GRIB2_LTYPE_LAKE_BOTTOM:        zaxistype = ZAXIS_LAKE_BOTTOM;            break;
    case GRIB2_LTYPE_SEDIMENT_BOTTOM:    zaxistype = ZAXIS_SEDIMENT_BOTTOM;        break;
    case GRIB2_LTYPE_SEDIMENT_BOTTOM_TA: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;     break;
    case GRIB2_LTYPE_SEDIMENT_BOTTOM_TW: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;     break;
    case GRIB2_LTYPE_MIX_LAYER:          zaxistype = ZAXIS_MIX_LAYER;              break;
    case GRIB2_LTYPE_REFERENCE:          zaxistype = ZAXIS_REFERENCE;              break;
124
125
    }

126
  return zaxistype;
127
}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
128

Uwe Schulzweida's avatar
Uwe Schulzweida committed
129

Uwe Schulzweida's avatar
Uwe Schulzweida committed
130
131
132
133
134
135
int zaxisTypeToGrib1ltype(int zaxistype)
{
  int grib_ltype = -1;

  switch (zaxistype)
    {
136
    case ZAXIS_SURFACE:               grib_ltype = GRIB1_LTYPE_SURFACE;            break;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
137
138
139
140
    case ZAXIS_GENERIC:               grib_ltype = -1;                             break;
    case ZAXIS_HYBRID:                grib_ltype = -1;                             break;
    case ZAXIS_HYBRID_HALF:           grib_ltype = -1;                             break;
    case ZAXIS_PRESSURE:              grib_ltype = GRIB1_LTYPE_ISOBARIC;           break;
141
142
    case ZAXIS_HEIGHT:                grib_ltype = GRIB1_LTYPE_HEIGHT;             break;
    case ZAXIS_DEPTH_BELOW_SEA:       grib_ltype = GRIB1_LTYPE_SEADEPTH;           break;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
143
    case ZAXIS_DEPTH_BELOW_LAND:      grib_ltype = GRIB1_LTYPE_LANDDEPTH;          break;
144
    case ZAXIS_ISENTROPIC:            grib_ltype = GRIB1_LTYPE_ISENTROPIC;         break;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
145
146
147
148
149
150
151
    case ZAXIS_TRAJECTORY:            grib_ltype = -1;                             break;
    case ZAXIS_ALTITUDE:              grib_ltype = GRIB1_LTYPE_ALTITUDE;           break;
    case ZAXIS_SIGMA:                 grib_ltype = GRIB1_LTYPE_SIGMA;              break;
    case ZAXIS_MEANSEA:               grib_ltype = GRIB1_LTYPE_MEANSEA;            break;
    case ZAXIS_TOA:                   grib_ltype = GRIB1_LTYPE_TOA;                break;
    case ZAXIS_SEA_BOTTOM:            grib_ltype = GRIB1_LTYPE_SEA_BOTTOM;         break;
    case ZAXIS_ATMOSPHERE:            grib_ltype = GRIB1_LTYPE_ATMOSPHERE;         break;
152
153
154
    case ZAXIS_CLOUD_BASE:            grib_ltype = GRIB1_LTYPE_CLOUD_BASE;         break;
    case ZAXIS_CLOUD_TOP:             grib_ltype = GRIB1_LTYPE_CLOUD_TOP;          break;
    case ZAXIS_ISOTHERM_ZERO:         grib_ltype = GRIB1_LTYPE_ISOTHERM0;          break;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
155
    case ZAXIS_SNOW:                  grib_ltype = -1;                             break;
156
157
158
159
160
    case ZAXIS_LAKE_BOTTOM:           grib_ltype = GRIB1_LTYPE_LAKE_BOTTOM;        break;
    case ZAXIS_SEDIMENT_BOTTOM:       grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM;    break;
    case ZAXIS_SEDIMENT_BOTTOM_TA:    grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TA; break;
    case ZAXIS_SEDIMENT_BOTTOM_TW:    grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TW; break;
    case ZAXIS_MIX_LAYER:             grib_ltype = GRIB1_LTYPE_MIX_LAYER;          break;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
161
    case ZAXIS_REFERENCE:             grib_ltype = -1;                             break;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
162
163
    }

164
  return grib_ltype;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
165
166
167
168
169
170
171
172
173
}


int zaxisTypeToGrib2ltype(int zaxistype)
{
  int grib_ltype = -1;

  switch (zaxistype)
    {
174
    case ZAXIS_SURFACE:               grib_ltype = GRIB2_LTYPE_SURFACE;            break;
175
176
177
178
    case ZAXIS_GENERIC:               grib_ltype = -1;                             break;
    case ZAXIS_HYBRID:                grib_ltype = GRIB2_LTYPE_HYBRID;             break;
    case ZAXIS_HYBRID_HALF:           grib_ltype = GRIB2_LTYPE_HYBRID;             break;
    case ZAXIS_PRESSURE:              grib_ltype = GRIB2_LTYPE_ISOBARIC;           break;
179
180
    case ZAXIS_HEIGHT:                grib_ltype = GRIB2_LTYPE_HEIGHT;             break;
    case ZAXIS_DEPTH_BELOW_SEA:       grib_ltype = GRIB2_LTYPE_SEADEPTH;           break;
181
    case ZAXIS_DEPTH_BELOW_LAND:      grib_ltype = GRIB2_LTYPE_LANDDEPTH;          break;
182
    case ZAXIS_ISENTROPIC:            grib_ltype = GRIB2_LTYPE_ISENTROPIC;         break;
183
184
185
186
187
188
189
    case ZAXIS_TRAJECTORY:            grib_ltype = -1;                             break;
    case ZAXIS_ALTITUDE:              grib_ltype = GRIB2_LTYPE_ALTITUDE;           break;
    case ZAXIS_SIGMA:                 grib_ltype = GRIB2_LTYPE_SIGMA;              break;
    case ZAXIS_MEANSEA:               grib_ltype = GRIB2_LTYPE_MEANSEA;            break;
    case ZAXIS_TOA:                   grib_ltype = GRIB2_LTYPE_TOA;                break;
    case ZAXIS_SEA_BOTTOM:            grib_ltype = GRIB2_LTYPE_SEA_BOTTOM;         break;
    case ZAXIS_ATMOSPHERE:            grib_ltype = GRIB2_LTYPE_ATMOSPHERE;         break;
190
191
192
    case ZAXIS_CLOUD_BASE:            grib_ltype = GRIB2_LTYPE_CLOUD_BASE;         break;
    case ZAXIS_CLOUD_TOP:             grib_ltype = GRIB2_LTYPE_CLOUD_TOP;          break;
    case ZAXIS_ISOTHERM_ZERO:         grib_ltype = GRIB2_LTYPE_ISOTHERM0;          break;
193
    case ZAXIS_SNOW:                  grib_ltype = GRIB2_LTYPE_SNOW;               break;
194
195
196
197
198
    case ZAXIS_LAKE_BOTTOM:           grib_ltype = GRIB2_LTYPE_LAKE_BOTTOM;        break;
    case ZAXIS_SEDIMENT_BOTTOM:       grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM;    break;
    case ZAXIS_SEDIMENT_BOTTOM_TA:    grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TA; break;
    case ZAXIS_SEDIMENT_BOTTOM_TW:    grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TW; break;
    case ZAXIS_MIX_LAYER:             grib_ltype = GRIB2_LTYPE_MIX_LAYER;          break;
199
    case ZAXIS_REFERENCE:             grib_ltype = GRIB2_LTYPE_REFERENCE;          break;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
200
201
    }

202
  return grib_ltype;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
203
204
205
}


Uwe Schulzweida's avatar
Uwe Schulzweida committed
206
207
208
209
int grbBitsPerValue(int datatype)
{
  int bitsPerValue = 16;

210
  if ( datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64 )
211
    Error("CDI/GRIB library does not support complex numbers!");
Uwe Schulzweida's avatar
Uwe Schulzweida committed
212

Uwe Schulzweida's avatar
Uwe Schulzweida committed
213
214
215
216
  if ( datatype != CDI_UNDEFID )
    {
      if ( datatype > 0 && datatype <= 32 )
	bitsPerValue = datatype;
217
      else if ( datatype == CDI_DATATYPE_FLT64 )
Uwe Schulzweida's avatar
Uwe Schulzweida committed
218
219
220
221
222
	bitsPerValue = 24;
      else
	bitsPerValue = 16;
    }

223
  return bitsPerValue;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
224
225
226
}


Uwe Schulzweida's avatar
Uwe Schulzweida committed
227
/*
228
int grbInqRecord(stream_t * streamptr, int *varID, int *levelID)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
229
230
231
{
  int status;

232
  status = cgribexInqRecord(streamptr, varID, levelID);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
233
234
235

  return (status);
}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
236
*/
Uwe Schulzweida's avatar
Uwe Schulzweida committed
237

238
void grbDefRecord(stream_t * streamptr)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
239
{
240
  UNUSED(streamptr);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
241
242
243
}

static
244
int grbScanTimestep1(stream_t * streamptr)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
245
{
246
  int status = CDI_EUFTYPE;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
247

248
#if  defined  (HAVE_LIBCGRIBEX)
249
250
  int filetype  = streamptr->filetype;

251
  if ( filetype == CDI_FILETYPE_GRB )
252
253
254
    status = cgribexScanTimestep1(streamptr);
#endif
#if defined(HAVE_LIBCGRIBEX) && defined (HAVE_LIBGRIB_API)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
255
  else
256
#endif
257
258
259
#ifdef HAVE_LIBGRIB_API
    status = gribapiScanTimestep1(streamptr);
#endif
260

261
  return status;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
262
263
264
}

static
265
int grbScanTimestep2(stream_t * streamptr)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
266
{
267
  int status = CDI_EUFTYPE;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
268

269
#if  defined  (HAVE_LIBCGRIBEX)
270
271
  int filetype = streamptr->filetype;

272
  if ( filetype == CDI_FILETYPE_GRB )
Uwe Schulzweida's avatar
Uwe Schulzweida committed
273
    {
274
      status = cgribexScanTimestep2(streamptr);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
275
    }
276
277
#endif
#if defined(HAVE_LIBCGRIBEX) && defined (HAVE_LIBGRIB_API)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
278
  else
279
#endif
280
281
282
#ifdef HAVE_LIBGRIB_API
    status = gribapiScanTimestep2(streamptr);
#endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
283

284
  return status;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
285
286
287
}

static
288
int grbScanTimestep(stream_t * streamptr)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
289
{
290
  int status = CDI_EUFTYPE;
291
  int filetype  = streamptr->filetype;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
292

293
#if  defined  (HAVE_LIBCGRIBEX)
294
  if ( filetype == CDI_FILETYPE_GRB )
295
    status = cgribexScanTimestep(streamptr);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
296
  else
297
#endif
298
299
300
301
302
#ifdef HAVE_LIBGRIB_API
    status = gribapiScanTimestep(streamptr);
#else
    Error("Sufficient GRIB support unavailable!");
#endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
303

304
  return status;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
305
306
307
}


308
#if  defined  (HAVE_LIBGRIB)
309
int grbInqContents(stream_t * streamptr)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
310
311
312
{
  streamptr->curTsID = 0;

313
  int status = grbScanTimestep1(streamptr);
314
  if ( status == 0 && streamptr->ntsteps == -1 ) status = grbScanTimestep2(streamptr);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
315

316
  int fileID = streamptr->fileID;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
317
318
  fileSetPos(fileID, 0, SEEK_SET);

319
  return status;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
320
}
321
#endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
322

323
int grbInqTimestep(stream_t * streamptr, int tsID)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
324
325
{
  if ( tsID == 0 && streamptr->rtsteps == 0 )
326
    Error("Call to cdiInqContents missing!");
Uwe Schulzweida's avatar
Uwe Schulzweida committed
327
328

  if ( CDI_Debug )
329
    Message("tsid = %d rtsteps = %d", tsID, streamptr->rtsteps);
330

331
  int ntsteps = CDI_UNDEFID;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
332
333
  while ( (tsID + 1) > streamptr->rtsteps && ntsteps == CDI_UNDEFID )
    {
334
      ntsteps = grbScanTimestep(streamptr);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
335
336
337
338
339
340
341
      if ( ntsteps == CDI_EUFSTRUCT )
	{
	  streamptr->ntsteps = streamptr->rtsteps;
	  break;
	}
    }

342
343
  int nrecs;

Uwe Schulzweida's avatar
Uwe Schulzweida committed
344
345
346
347
348
349
350
351
352
353
  if ( tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID )
    {
      nrecs = 0;
    }
  else
    {
      streamptr->curTsID = tsID;
      nrecs = streamptr->tsteps[tsID].nrecs;
    }

354
  return nrecs;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
355
356
357
}


Uwe Schulzweida's avatar
Uwe Schulzweida committed
358
void streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
359
{
360
  stream_t *streamptr = stream_to_pointer(streamID);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
361

362
  int filetype = streamptr->filetype;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
363

364
  if ( filetype == CDI_FILETYPE_GRB )
Uwe Schulzweida's avatar
Uwe Schulzweida committed
365
    {
366
367
368
369
370
      int tsID     = streamptr->curTsID;
      int vrecID   = streamptr->tsteps[tsID].curRecID;
      int recID    = streamptr->tsteps[tsID].recIDs[vrecID];
      off_t recpos = streamptr->tsteps[tsID].records[recID].position;
      int zip      = streamptr->tsteps[tsID].records[recID].zip;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
371

372
373
      void *gribbuffer = streamptr->record->buffer;
      size_t gribbuffersize = streamptr->record->buffersize;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
374
375

      if ( zip > 0 )
376
	Error("Compressed GRIB records unsupported!");
Uwe Schulzweida's avatar
Uwe Schulzweida committed
377
      else
Uwe Schulzweida's avatar
Uwe Schulzweida committed
378
        grib_info_for_grads(recpos, (long)gribbuffersize, (unsigned char *) gribbuffer, intnum, fltnum, bignum);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
379
380
    }
}
381
382
383
384
385
386
387
388
389
/*
 * Local Variables:
 * c-file-style: "Java"
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * show-trailing-whitespace: t
 * require-trailing-newline: t
 * End:
 */