Commit 4f2847c7 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

stream_gribapi: replaced streamID by streamptr

parent 75dfa354
#ifndef _STREAM_CGRIBEX_H
#define _STREAM_CGRIBEX_H
int cgribexScanTimestep1(int streamID);
int cgribexScanTimestep2(int streamID);
int cgribexScanTimestep(int streamID);
int cgribexScanTimestep1(stream_t * streamptr);
int cgribexScanTimestep2(stream_t * streamptr);
int cgribexScanTimestep(stream_t * streamptr);
int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int unreduced, int *nmiss, int *zip, double missval);
......
......@@ -200,12 +200,12 @@ int grbScanTimestep1(int streamID)
#if defined (HAVE_LIBCGRIBEX)
if ( filetype == FILETYPE_GRB )
{
status = cgribexScanTimestep1(streamID);
status = cgribexScanTimestep1(streamptr);
}
else
#endif
{
status = gribapiScanTimestep1(streamID);
status = gribapiScanTimestep1(streamptr);
}
return (status);
......@@ -224,12 +224,12 @@ int grbScanTimestep2(int streamID)
#if defined (HAVE_LIBCGRIBEX)
if ( filetype == FILETYPE_GRB )
{
status = cgribexScanTimestep2(streamID);
status = cgribexScanTimestep2(streamptr);
}
else
#endif
{
status = gribapiScanTimestep2(streamID);
status = gribapiScanTimestep2(streamptr);
}
return (status);
......@@ -248,12 +248,12 @@ int grbScanTimestep(int streamID)
#if defined (HAVE_LIBCGRIBEX)
if ( filetype == FILETYPE_GRB )
{
status = cgribexScanTimestep(streamID);
status = cgribexScanTimestep(streamptr);
}
else
#endif
{
status = gribapiScanTimestep(streamID);
status = gribapiScanTimestep(streamptr);
}
return (status);
......@@ -275,7 +275,7 @@ int grbInqContents(int streamID)
streamptr->curTsID = 0;
status = grbScanTimestep1(streamID);
if ( status == 0 && streamptr->ntsteps == -1 ) status = grbScanTimestep2(streamID);
fileSetPos(fileID, 0, SEEK_SET);
......@@ -298,7 +298,7 @@ int grbInqTimestep(int streamID, int tsID)
if ( CDI_Debug )
Message("tsid = %d rtsteps = %d", tsID, streamptr->rtsteps);
ntsteps = CDI_UNDEFID;
while ( (tsID + 1) > streamptr->rtsteps && ntsteps == CDI_UNDEFID )
{
......
......@@ -756,7 +756,7 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
}
static
void gribapiAddRecord(int streamID, int param, grib_handle *gh,
void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
long recsize, off_t position, int datatype, int comptype)
{
long editionNumber;
......@@ -771,7 +771,6 @@ void gribapiAddRecord(int streamID, int param, grib_handle *gh,
record_t *record;
grid_t grid;
int vlistID;
stream_t *streamptr;
int leveltype;
long lpar;
int status;
......@@ -779,8 +778,6 @@ void gribapiAddRecord(int streamID, int param, grib_handle *gh,
size_t vlen;
long ens_index = 0, ens_count = 0, ens_forecast_type = 0;
streamptr = stream_to_pointer(streamID);
vlistID = streamptr->vlistID;
tsID = streamptr->curTsID;
recID = recordNewEntry(streamptr, tsID);
......@@ -958,7 +955,7 @@ void gribapiAddRecord(int streamID, int param, grib_handle *gh,
}
#endif
int gribapiScanTimestep1(int streamID)
int gribapiScanTimestep1(stream_t * streamptr)
{
#if defined (HAVE_LIBGRIB_API)
off_t recpos = 0;
......@@ -987,7 +984,6 @@ int gribapiScanTimestep1(int streamID)
int comptype;
long unzipsize;
compvar2_t compVar, compVar0;
stream_t *streamptr;
grib_handle *gh = NULL;
int leveltype;
int pdis = 0, pcat = 0, pnum = 0;
......@@ -997,10 +993,6 @@ int gribapiScanTimestep1(int streamID)
int lieee = FALSE;
int lbounds;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
streamptr->curTsID = 0;
tsID = tstepsNewEntry(streamptr);
......@@ -1192,7 +1184,7 @@ int gribapiScanTimestep1(int streamID)
if ( CDI_Debug )
Message("%4d %8d %4d %8d %8d %6d", nrecs, (int)recpos, param, level1, vdate, vtime);
gribapiAddRecord(streamID, param, gh, recsize, recpos, datatype, comptype);
gribapiAddRecord(streamptr, param, gh, recsize, recpos, datatype, comptype);
grib_handle_delete(gh);
gh = NULL;
......@@ -1271,7 +1263,7 @@ int gribapiScanTimestep1(int streamID)
}
int gribapiScanTimestep2(int streamID)
int gribapiScanTimestep2(stream_t * streamptr)
{
int rstatus = 0;
#if defined (HAVE_LIBGRIB_API)
......@@ -1295,7 +1287,6 @@ int gribapiScanTimestep2(int streamID)
int vlistID;
long unzipsize;
compvar2_t compVar, compVar0;
stream_t *streamptr;
grib_handle *gh = NULL;
int leveltype;
int pdis = 0, pcat = 0, pnum = 0;
......@@ -1304,10 +1295,6 @@ int gribapiScanTimestep2(int streamID)
long lpar;
int lbounds;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
streamptr->curTsID = 1;
fileID = streamptr->fileID;
......@@ -1574,7 +1561,7 @@ int gribapiScanTimestep2(int streamID)
}
int gribapiScanTimestep(int streamID)
int gribapiScanTimestep(stream_t * streamptr)
{
int rstatus = 0;
#if defined (HAVE_LIBGRIB_API)
......@@ -1596,7 +1583,6 @@ int gribapiScanTimestep(int streamID)
int rindex, nrecs = 0;
long unzipsize;
compvar2_t compVar, compVar0;
stream_t *streamptr;
grib_handle *gh = NULL;
int leveltype;
int pdis = 0, pcat = 0, pnum = 0;
......@@ -1605,15 +1591,11 @@ int gribapiScanTimestep(int streamID)
long lpar;
int lbounds;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
vlistID = streamptr->vlistID;
if ( CDI_Debug )
{
Message("streamID = %d", streamID);
Message("streamptr = %p", streamptr);
Message("cts = %d", streamptr->curTsID);
Message("rts = %d", streamptr->rtsteps);
Message("nts = %d", streamptr->ntsteps);
......
#ifndef _STREAM_GRIBAPI_H
#define _STREAM_GRIBAPI_H
int gribapiScanTimestep1(int streamID);
int gribapiScanTimestep2(int streamID);
int gribapiScanTimestep(int streamID);
int gribapiScanTimestep1(stream_t * streamptr);
int gribapiScanTimestep2(stream_t * streamptr);
int gribapiScanTimestep(stream_t * streamptr);
int gribapiDecode(unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int unreduced, int *nmiss, int *zip, double missval);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment