Commit b054fa1c authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

grbDecode: added paremeter memtype

parent c145cb70
......@@ -17,7 +17,7 @@
static
int grbDecode(int filetype, unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int grbDecode(int memtype, int filetype, unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int unreduced, int *nmiss, double missval, int vlistID, int varID)
{
int status = 0;
......@@ -30,7 +30,7 @@ int grbDecode(int filetype, unsigned char *gribbuffer, int gribsize, double *dat
if ( cdiNAdditionalGRIBKeys > 0 )
Error("CGRIBEX decode does not support reading of additional GRIB keys!");
#endif
status = cgribexDecode(gribbuffer, gribsize, data, gridsize, unreduced, nmiss, missval);
status = cgribexDecode(memtype, gribbuffer, gribsize, data, gridsize, unreduced, nmiss, missval);
}
else
#endif
......@@ -43,7 +43,7 @@ int grbDecode(int filetype, unsigned char *gribbuffer, int gribsize, double *dat
}
#endif
return (status);
return status;
}
static
......@@ -127,7 +127,7 @@ void grbReadRecord(stream_t * streamptr, double *data, int *nmiss)
streamptr->tsteps[tsID].records[recID].zip = grbUnzipRecord(gribbuffer, &recsize);
grbDecode(filetype, gribbuffer, (int)recsize, data, gridsize, streamptr->unreduced, nmiss, missval, vlistID, varID);
grbDecode(MEMTYPE_DOUBLE, filetype, gribbuffer, (int)recsize, data, gridsize, streamptr->unreduced, nmiss, missval, vlistID, varID);
}
......@@ -167,7 +167,7 @@ void grbReadVarDP(stream_t * streamptr, int varID, double *data, int *nmiss)
streamptr->tsteps[tsID].records[recID].zip = grbUnzipRecord(gribbuffer, &recsize);
grbDecode(filetype, gribbuffer, (int)recsize, &data[levelID*gridsize], gridsize,
grbDecode(MEMTYPE_DOUBLE, filetype, gribbuffer, (int)recsize, &data[levelID*gridsize], gridsize,
streamptr->unreduced, &imiss, missval, vlistID, varID);
*nmiss += imiss;
......@@ -177,7 +177,7 @@ void grbReadVarDP(stream_t * streamptr, int varID, double *data, int *nmiss)
}
void grbReadVarSliceDP(stream_t * streamptr, int varID, int levelID, double *data, int *nmiss)
void grbReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, int *nmiss)
{
int filetype = streamptr->filetype;
......@@ -206,14 +206,12 @@ void grbReadVarSliceDP(stream_t * streamptr, int varID, int levelID, double *dat
recID+1, tsID+1);
fileSetPos(fileID, recpos, SEEK_SET);
fileRead(fileID, gribbuffer, recsize);
double missval = vlistInqVarMissval(vlistID, varID);
streamptr->tsteps[tsID].records[recID].zip = grbUnzipRecord(gribbuffer, &recsize);
grbDecode(filetype, gribbuffer, (int)recsize, data, gridsize, streamptr->unreduced, nmiss, missval, vlistID, varID);
double missval = vlistInqVarMissval(vlistID, varID);
grbDecode(MEMTYPE_DOUBLE, filetype, gribbuffer, (int)recsize, data, gridsize, streamptr->unreduced, nmiss, missval, vlistID, varID);
fileSetPos(fileID, currentfilepos, SEEK_SET);
}
......
......@@ -1308,7 +1308,7 @@ int cgribexScanTimestep(stream_t * streamptr)
#endif
#if defined (HAVE_LIBCGRIBEX)
int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int cgribexDecode(int memtype, unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int unreduced, int *nmiss, double missval)
{
int status = 0;
......@@ -1322,7 +1322,7 @@ int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gri
FSEC3_MissVal = missval;
gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, data,
gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, (double*) data,
gridsize, (int *)(void *)gribbuffer, gribsize, &iword, hoper, &iret);
if ( ISEC1_Sec2Or3Flag & 64 )
......@@ -2160,7 +2160,7 @@ void cgribexDefEnsembleVar(int *isec1, int vlistID, int varID)
#if defined (HAVE_LIBCGRIBEX)
size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID,
int vdate, int vtime, int tsteptype, int numavg,
long datasize, const double *data, int nmiss, unsigned char *gribbuffer, size_t gribbuffersize)
long datasize, const void *data, int nmiss, unsigned char *gribbuffer, size_t gribbuffersize)
{
size_t nbytes = 0;
int gribsize;
......
......@@ -5,12 +5,12 @@ 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 cgribexDecode(int memtype, unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int unreduced, int *nmiss, double missval);
size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID,
int vdate, int vtime, int tsteptype, int numavg,
long datasize, const double *data, int nmiss, unsigned char *gribbuffer, size_t gribbuffersize);
int vdate, int vtime, int tsteptype, int numavg,
long datasize, const void *data, int nmiss, unsigned char *gribbuffer, size_t gribbuffersize);
#endif /* _STREAM_CGRIBEX_H */
/*
......
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