Commit 9c15bac8 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

stream_grb: replaced streamID by streamptr

parent 4f2847c7
......@@ -547,7 +547,7 @@ int cdiInqContents(int streamID)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
status = grbInqContents(streamID);
status = grbInqContents(streamptr);
break;
}
#endif
......@@ -1503,7 +1503,7 @@ int streamInqTimestep(int streamID, int tsID)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
nrecs = grbInqTimestep(streamID, tsID);
nrecs = grbInqTimestep(streamptr, tsID);
break;
}
#endif
......@@ -1595,7 +1595,7 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
grbReadVarDP(streamID, varID, data, nmiss);
grbReadVarDP(streamptr, varID, data, nmiss);
break;
}
#endif
......@@ -1817,7 +1817,7 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
grbReadVarSliceDP(streamID, varID, levelID, data, nmiss);
grbReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
break;
}
#endif
......
......@@ -98,24 +98,19 @@ int grbBitsPerValue(int datatype)
/*
int grbInqRecord(int streamID, int *varID, int *levelID)
int grbInqRecord(stream_t * streamptr, int *varID, int *levelID)
{
int status;
status = cgribexInqRecord(streamID, varID, levelID);
status = cgribexInqRecord(streamptr, varID, levelID);
return (status);
}
*/
int grbDefRecord(int streamID)
int grbDefRecord(stream_t * streamptr)
{
int status = 0;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
return (status);
}
......@@ -132,12 +127,12 @@ int grbDecode(int filetype, unsigned char *gribbuffer, int gribsize, double *dat
else
#endif
status = gribapiDecode(gribbuffer, gribsize, data, gridsize, unreduced, nmiss, zip, missval);
return (status);
}
int grbReadRecord(int streamID, double *data, int *nmiss)
int grbReadRecord(stream_t * streamptr, double *data, int *nmiss)
{
int status = 0;
unsigned char *gribbuffer;
......@@ -150,11 +145,6 @@ int grbReadRecord(int streamID, double *data, int *nmiss)
int zip;
int filetype;
double missval;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
filetype = streamptr->filetype;
......@@ -188,13 +178,11 @@ int grbReadRecord(int streamID, double *data, int *nmiss)
}
static
int grbScanTimestep1(int streamID)
int grbScanTimestep1(stream_t * streamptr)
{
int status;
int filetype;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
filetype = streamptr->filetype;
#if defined (HAVE_LIBCGRIBEX)
......@@ -212,13 +200,11 @@ int grbScanTimestep1(int streamID)
}
static
int grbScanTimestep2(int streamID)
int grbScanTimestep2(stream_t * streamptr)
{
int status;
int filetype;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
filetype = streamptr->filetype;
#if defined (HAVE_LIBCGRIBEX)
......@@ -236,13 +222,11 @@ int grbScanTimestep2(int streamID)
}
static
int grbScanTimestep(int streamID)
int grbScanTimestep(stream_t * streamptr)
{
int status;
int filetype;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
filetype = streamptr->filetype;
#if defined (HAVE_LIBCGRIBEX)
......@@ -260,23 +244,18 @@ int grbScanTimestep(int streamID)
}
int grbInqContents(int streamID)
int grbInqContents(stream_t * streamptr)
{
int fileID;
int status = 0;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
fileID = streamptr->fileID;
streamptr->curTsID = 0;
status = grbScanTimestep1(streamID);
status = grbScanTimestep1(streamptr);
if ( status == 0 && streamptr->ntsteps == -1 ) status = grbScanTimestep2(streamID);
if ( status == 0 && streamptr->ntsteps == -1 ) status = grbScanTimestep2(streamptr);
fileSetPos(fileID, 0, SEEK_SET);
......@@ -284,14 +263,9 @@ int grbInqContents(int streamID)
}
int grbInqTimestep(int streamID, int tsID)
int grbInqTimestep(stream_t * streamptr, int tsID)
{
int ntsteps, nrecs;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
if ( tsID == 0 && streamptr->rtsteps == 0 )
Error("Call to cdiInqContents missing!");
......@@ -302,7 +276,7 @@ int grbInqTimestep(int streamID, int tsID)
ntsteps = CDI_UNDEFID;
while ( (tsID + 1) > streamptr->rtsteps && ntsteps == CDI_UNDEFID )
{
ntsteps = grbScanTimestep(streamID);
ntsteps = grbScanTimestep(streamptr);
if ( ntsteps == CDI_EUFSTRUCT )
{
streamptr->ntsteps = streamptr->rtsteps;
......@@ -324,7 +298,7 @@ int grbInqTimestep(int streamID, int tsID)
}
void grbReadVarDP(int streamID, int varID, double *data, int *nmiss)
void grbReadVarDP(stream_t * streamptr, int varID, double *data, int *nmiss)
{
int fileID;
int levelID, nlevs, gridID, gridsize;
......@@ -337,11 +311,6 @@ void grbReadVarDP(int streamID, int varID, double *data, int *nmiss)
int zip;
int filetype;
double missval;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
filetype = streamptr->filetype;
......@@ -385,7 +354,7 @@ void grbReadVarDP(int streamID, int varID, double *data, int *nmiss)
}
void grbReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *nmiss)
void grbReadVarSliceDP(stream_t * streamptr, int varID, int levelID, double *data, int *nmiss)
{
int fileID;
int gridID, gridsize;
......@@ -397,11 +366,6 @@ void grbReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *
int zip;
int filetype;
double missval;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
filetype = streamptr->filetype;
......@@ -616,7 +580,7 @@ void grb_write_var(stream_t *streamptr, int varID, int memtype, const void *data
}
int grbCopyRecord(int streamID2, int streamID1)
int grbCopyRecord(stream_t * streamptr2, stream_t * streamptr1)
{
int fileID1, fileID2;
int tsID, recID, vrecID;
......@@ -629,14 +593,6 @@ int grbCopyRecord(int streamID2, int streamID1)
size_t nbytes;
long unzipsize;
int izip;
stream_t *streamptr1;
stream_t *streamptr2;
streamptr1 = stream_to_pointer(streamID1);
streamptr2 = stream_to_pointer(streamID2);
stream_check_ptr(__func__, streamptr1);
stream_check_ptr(__func__, streamptr2);
filetype = streamptr1->filetype;
......@@ -676,15 +632,10 @@ int grbCopyRecord(int streamID2, int streamID1)
}
int grb_write_record(int streamID, int memtype, const void *data, int nmiss)
int grb_write_record(stream_t * streamptr, int memtype, const void *data, int nmiss)
{
int status = 0;
int varID, levelID;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
varID = streamptr->record->varID;
levelID = streamptr->record->levelID;
......
......@@ -3,19 +3,19 @@
int grbBitsPerValue(int datatype);
int grbInqContents(int streamID);
int grbInqTimestep(int streamID, int tsID);
int grbInqContents(stream_t * streamptr);
int grbInqTimestep(stream_t * streamptr, int tsID);
int grbInqRecord(int streamID, int *varID, int *levelID);
int grbDefRecord(int streamID);
int grb_write_record(int streamID, int memtype, const void *data, int nmiss);
int grbReadRecord(int streamID, double *data, int *nmiss);
int grbCopyRecord(int streamIDdest, int streamIDsrc);
int grbInqRecord(stream_t * streamptr, int *varID, int *levelID);
int grbDefRecord(stream_t * streamptr);
int grb_write_record(stream_t * streamptr, int memtype, const void *data, int nmiss);
int grbReadRecord(stream_t * streamptr, double *data, int *nmiss);
int grbCopyRecord(stream_t * streamptr2, stream_t * streamptr1);
void grbReadVarDP(int streamID, int varID, double *data, int *nmiss);
void grb_write_var(stream_t *streamptr, int varID, int memtype, const void *data, int nmiss);
void grbReadVarDP(stream_t * streamptr, int varID, double *data, int *nmiss);
void grb_write_var(stream_t * streamptr, int varID, int memtype, const void *data, int nmiss);
void grbReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *nmiss);
void grbReadVarSliceDP(stream_t * streamptr, int varID, int levelID, double *data, int *nmiss);
int grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, int nmiss);
int grib1ltypeToZaxisType(int grib_ltype);
......
......@@ -241,7 +241,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
status = grbDefRecord(streamID);
status = grbDefRecord(streamptr);
break;
}
#endif
......@@ -309,7 +309,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
status = grbReadRecord(streamID, data, nmiss);
status = grbReadRecord(streamptr, data, nmiss);
break;
}
#endif
......@@ -373,7 +373,7 @@ void stream_write_record(int streamID, int memtype, const void *data, int nmiss)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
status = grb_write_record(streamID, memtype, data, nmiss);
status = grb_write_record(streamptr, memtype, data, nmiss);
break;
}
#endif
......@@ -455,7 +455,7 @@ void streamCopyRecord(int streamID2, int streamID1)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{
status = grbCopyRecord(streamID2, streamID1);
status = grbCopyRecord(streamptr2, streamptr1);
break;
}
#endif
......
Supports Markdown
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