Commit 6d9469c6 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Merge declaration and definition.

parent b3aee032
...@@ -753,14 +753,13 @@ int cgribexScanTimestep1(stream_t *streamptr) ...@@ -753,14 +753,13 @@ int cgribexScanTimestep1(stream_t *streamptr)
size_t buffersize = 0; size_t buffersize = 0;
int leveltype = 0, level1 = 0, level2 = 0, vdate = 0, vtime = 0; int leveltype = 0, level1 = 0, level2 = 0, vdate = 0, vtime = 0;
DateTime datetime, datetime0 = { LONG_MIN, LONG_MIN }; DateTime datetime, datetime0 = { LONG_MIN, LONG_MIN };
unsigned nrecords, recID; unsigned recID;
int nrecs_scanned = 0; int nrecs_scanned = 0;
bool warn_time = true; bool warn_time = true;
bool warn_numavg = true; bool warn_numavg = true;
int taxisID = -1; int taxisID = -1;
int rdate = 0, rtime = 0, tunit = 0; int rdate = 0, rtime = 0, tunit = 0;
bool fcast = false; bool fcast = false;
int vlistID;
char paramstr[32]; char paramstr[32];
streamptr->curTsID = 0; streamptr->curTsID = 0;
...@@ -892,10 +891,10 @@ int cgribexScanTimestep1(stream_t *streamptr) ...@@ -892,10 +891,10 @@ int cgribexScanTimestep1(stream_t *streamptr)
taxis->vdate = (int)datetime0.date; taxis->vdate = (int)datetime0.date;
taxis->vtime = (int)datetime0.time; taxis->vtime = (int)datetime0.time;
vlistID = streamptr->vlistID; int vlistID = streamptr->vlistID;
vlistDefTaxis(vlistID, taxisID); vlistDefTaxis(vlistID, taxisID);
nrecords = (unsigned)streamptr->tsteps[0].nallrecs; unsigned nrecords = (unsigned)streamptr->tsteps[0].nallrecs;
if ( nrecords < (unsigned)streamptr->tsteps[0].recordSize ) if ( nrecords < (unsigned)streamptr->tsteps[0].recordSize )
{ {
streamptr->tsteps[0].recordSize = (int)nrecords; streamptr->tsteps[0].recordSize = (int)nrecords;
...@@ -970,7 +969,7 @@ int cgribexScanTimestep2(stream_t * streamptr) ...@@ -970,7 +969,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
if ( rindex > nrecords ) break; if ( rindex > nrecords ) break;
size_t recsize = gribGetSize(fileID); size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID); recpos = fileGetPos(fileID);
if ( recsize == 0 ) if ( recsize == 0 )
{ {
streamptr->ntsteps = 2; streamptr->ntsteps = 2;
......
...@@ -141,30 +141,30 @@ void extCopyRecord(stream_t *streamptr2, stream_t *streamptr1) ...@@ -141,30 +141,30 @@ void extCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
void extDefRecord(stream_t *streamptr) void extDefRecord(stream_t *streamptr)
{ {
Record *record = streamptr->record;
int pdis, pcat, pnum; int pdis, pcat, pnum;
cdiDecodeParam(streamptr->record->param, &pnum, &pcat, &pdis); cdiDecodeParam(record->param, &pnum, &pcat, &pdis);
int header[4]; int header[4];
header[0] = streamptr->record->date; header[0] = record->date;
header[1] = pnum; header[1] = pnum;
header[2] = streamptr->record->level; header[2] = record->level;
int gridID = streamptr->record->gridID; int gridID = record->gridID;
cdi_check_gridsize_int_limit("EXTRA", gridInqSize(gridID)); cdi_check_gridsize_int_limit("EXTRA", gridInqSize(gridID));
header[3] = (int) gridInqSize(gridID); header[3] = (int) gridInqSize(gridID);
extrec_t *extp = (extrec_t*) streamptr->record->exsep; extrec_t *extp = (extrec_t*) record->exsep;
extDefDatatype(streamptr->record->prec, &extp->prec, &extp->number); extDefDatatype(record->prec, &extp->prec, &extp->number);
extDefHeader(extp, header); extDefHeader(extp, header);
} }
void extWriteRecord(stream_t *streamptr, const double *data) void extWriteRecord(stream_t *streamptr, const double *data)
{ {
int fileID = streamptr->fileID;
void *extp = streamptr->record->exsep; void *extp = streamptr->record->exsep;
extDefDataDP(extp, data); extDefDataDP(extp, data);
extWrite(fileID, extp); extWrite(streamptr->fileID, extp);
} }
static static
...@@ -189,16 +189,15 @@ void extAddRecord(stream_t *streamptr, int param, int level, size_t xysize, ...@@ -189,16 +189,15 @@ void extAddRecord(stream_t *streamptr, int param, int level, size_t xysize,
struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0);
int gridID = gridAdded.Id; int gridID = gridAdded.Id;
if (!gridAdded.isNew) Free(grid); if (!gridAdded.isNew) Free(grid);
/*
if ( level == 0 ) leveltype = ZAXIS_SURFACE;
else leveltype = ZAXIS_GENERIC;
*/
int leveltype = ZAXIS_GENERIC; int leveltype = ZAXIS_GENERIC;
int datatype = extInqDatatype(prec, number);
int varID, levelID = 0; int varID, levelID = 0;
varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0, varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0,
extInqDatatype(prec, number), &varID, &levelID, TSTEP_INSTANT, 0, 0, -1, datatype, &varID, &levelID, TSTEP_INSTANT, 0, 0, -1,
NULL, NULL, NULL, NULL, NULL, NULL, 0); NULL, NULL, NULL, NULL, NULL, NULL, 0);
record->varID = (short)varID; record->varID = (short)varID;
record->levelID = (short)levelID; record->levelID = (short)levelID;
...@@ -214,9 +213,7 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -214,9 +213,7 @@ void extScanTimestep1(stream_t *streamptr)
{ {
int header[4]; int header[4];
DateTime datetime0 = { LONG_MIN, LONG_MIN }; DateTime datetime0 = { LONG_MIN, LONG_MIN };
int varID;
off_t recpos = 0; off_t recpos = 0;
long recsize;
int recID; int recID;
extcompvar_t compVar, compVar0; extcompvar_t compVar, compVar0;
extrec_t *extp = (extrec_t*) streamptr->record->exsep; extrec_t *extp = (extrec_t*) streamptr->record->exsep;
...@@ -224,10 +221,9 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -224,10 +221,9 @@ void extScanTimestep1(stream_t *streamptr)
streamptr->curTsID = 0; streamptr->curTsID = 0;
int tsID = tstepsNewEntry(streamptr); int tsID = tstepsNewEntry(streamptr);
taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
if ( tsID != 0 ) if ( tsID != 0 )
Error("Internal problem! tstepsNewEntry returns %d", tsID); Error("Internal problem! tstepsNewEntry returns %d", tsID);
taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
int fileID = streamptr->fileID; int fileID = streamptr->fileID;
...@@ -241,7 +237,7 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -241,7 +237,7 @@ void extScanTimestep1(stream_t *streamptr)
streamptr->ntsteps = 1; streamptr->ntsteps = 1;
break; break;
} }
recsize = fileGetPos(fileID) - recpos; size_t recsize = (size_t)(fileGetPos(fileID) - recpos);
extInqHeader(extp, header); extInqHeader(extp, header);
...@@ -264,7 +260,7 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -264,7 +260,7 @@ void extScanTimestep1(stream_t *streamptr)
compVar.level = rlevel; compVar.level = rlevel;
for ( recID = 0; recID < nrecs; recID++ ) for ( recID = 0; recID < nrecs; recID++ )
{ {
compVar0.param = streamptr->tsteps[0].records[recID].param; compVar0.param = streamptr->tsteps[0].records[recID].param;
compVar0.level = streamptr->tsteps[0].records[recID].ilevel; compVar0.level = streamptr->tsteps[0].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(extcompvar_t)) == 0 ) break; if ( memcmp(&compVar0, &compVar, sizeof(extcompvar_t)) == 0 ) break;
...@@ -280,7 +276,7 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -280,7 +276,7 @@ void extScanTimestep1(stream_t *streamptr)
if ( CDI_Debug ) if ( CDI_Debug )
Message("%4d%8d%4d%8d%8d%6d", nrecs, (int)recpos, rcode, rlevel, vdate, vtime); Message("%4d%8d%4d%8d%8d%6d", nrecs, (int)recpos, rcode, rlevel, vdate, vtime);
extAddRecord(streamptr, param, rlevel, rxysize, (size_t)recsize, recpos, extp->prec, extp->number); extAddRecord(streamptr, param, rlevel, rxysize, recsize, recpos, extp->prec, extp->number);
} }
streamptr->rtsteps = 1; streamptr->rtsteps = 1;
...@@ -309,12 +305,12 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -309,12 +305,12 @@ void extScanTimestep1(stream_t *streamptr)
streamptr->tsteps[0].recIDs = (int *) Malloc((size_t)nrecords * sizeof (int)); streamptr->tsteps[0].recIDs = (int *) Malloc((size_t)nrecords * sizeof (int));
streamptr->tsteps[0].nrecs = nrecords; streamptr->tsteps[0].nrecs = nrecords;
for ( recID = 0; recID < nrecords; recID++ ) for ( int recID = 0; recID < nrecords; recID++ )
streamptr->tsteps[0].recIDs[recID] = recID; streamptr->tsteps[0].recIDs[recID] = recID;
if ( streamptr->ntsteps == -1 ) if ( streamptr->ntsteps == -1 )
{ {
tsID = tstepsNewEntry(streamptr); int tsID = tstepsNewEntry(streamptr);
if ( tsID != streamptr->rtsteps ) if ( tsID != streamptr->rtsteps )
Error("Internal error. tsID = %d", tsID); Error("Internal error. tsID = %d", tsID);
...@@ -327,7 +323,7 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -327,7 +323,7 @@ void extScanTimestep1(stream_t *streamptr)
if ( taxis->vdate == 0 && taxis->vtime == 0 ) if ( taxis->vdate == 0 && taxis->vtime == 0 )
{ {
streamptr->ntsteps = 0; streamptr->ntsteps = 0;
for ( varID = 0; varID < streamptr->nvars; varID++ ) for ( int varID = 0; varID < streamptr->nvars; varID++ )
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT); vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
} }
} }
...@@ -337,7 +333,6 @@ static ...@@ -337,7 +333,6 @@ static
int extScanTimestep2(stream_t *streamptr) int extScanTimestep2(stream_t *streamptr)
{ {
int header[4]; int header[4];
int varID;
off_t recpos = 0; off_t recpos = 0;
extcompvar_t compVar, compVar0; extcompvar_t compVar, compVar0;
void *extp = streamptr->record->exsep; void *extp = streamptr->record->exsep;
...@@ -348,8 +343,7 @@ int extScanTimestep2(stream_t *streamptr) ...@@ -348,8 +343,7 @@ int extScanTimestep2(stream_t *streamptr)
int vlistID = streamptr->vlistID; int vlistID = streamptr->vlistID;
int tsID = streamptr->rtsteps; int tsID = streamptr->rtsteps;
if ( tsID != 1 ) if ( tsID != 1 ) Error("Internal problem! unexpected timestep %d", tsID+1);
Error("Internal problem! unexpected timestep %d", tsID+1);
taxis_t *taxis = &streamptr->tsteps[tsID].taxis; taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
...@@ -365,7 +359,6 @@ int extScanTimestep2(stream_t *streamptr) ...@@ -365,7 +359,6 @@ int extScanTimestep2(stream_t *streamptr)
for ( int recID = 0; recID < nrecords; recID++ ) for ( int recID = 0; recID < nrecords; recID++ )
{ {
varID = streamptr->tsteps[0].records[recID].varID;
streamptr->tsteps[tsID].records[recID].position = streamptr->tsteps[tsID].records[recID].position =
streamptr->tsteps[0].records[recID].position; streamptr->tsteps[0].records[recID].position;
streamptr->tsteps[tsID].records[recID].size = streamptr->tsteps[tsID].records[recID].size =
...@@ -456,7 +449,7 @@ int extScanTimestep2(stream_t *streamptr) ...@@ -456,7 +449,7 @@ int extScanTimestep2(stream_t *streamptr)
{ {
if ( ! streamptr->tsteps[tsID].records[recID].used ) if ( ! streamptr->tsteps[tsID].records[recID].used )
{ {
varID = streamptr->tsteps[tsID].records[recID].varID; int varID = streamptr->tsteps[tsID].records[recID].varID;
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT); vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
} }
else else
...@@ -470,7 +463,7 @@ int extScanTimestep2(stream_t *streamptr) ...@@ -470,7 +463,7 @@ int extScanTimestep2(stream_t *streamptr)
if ( streamptr->ntsteps == -1 ) if ( streamptr->ntsteps == -1 )
{ {
tsID = tstepsNewEntry(streamptr); int tsID = tstepsNewEntry(streamptr);
if ( tsID != streamptr->rtsteps ) if ( tsID != streamptr->rtsteps )
Error("Internal error. tsID = %d", tsID); Error("Internal error. tsID = %d", tsID);
...@@ -488,11 +481,9 @@ int extInqContents(stream_t *streamptr) ...@@ -488,11 +481,9 @@ int extInqContents(stream_t *streamptr)
extScanTimestep1(streamptr); extScanTimestep1(streamptr);
int status = 0; int status = (streamptr->ntsteps == -1) ? extScanTimestep2(streamptr) : 0;
if ( streamptr->ntsteps == -1 ) status = extScanTimestep2(streamptr);
int fileID = streamptr->fileID; fileSetPos(streamptr->fileID, 0, SEEK_SET);
fileSetPos(fileID, 0, SEEK_SET);
return status; return status;
} }
...@@ -506,15 +497,6 @@ long extScanTimestep(stream_t *streamptr) ...@@ -506,15 +497,6 @@ long extScanTimestep(stream_t *streamptr)
int nrecs = 0; int nrecs = 0;
extcompvar_t compVar, compVar0; extcompvar_t compVar, compVar0;
void *extp = streamptr->record->exsep; void *extp = streamptr->record->exsep;
/*
if ( CDI_Debug )
{
Message("streamID = %d", streamptr->self);
Message("cts = %d", streamptr->curTsID);
Message("rts = %d", streamptr->rtsteps);
Message("nts = %d", streamptr->ntsteps);
}
*/
int tsID = streamptr->rtsteps; int tsID = streamptr->rtsteps;
taxis_t *taxis = &streamptr->tsteps[tsID].taxis; taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
......
...@@ -57,8 +57,7 @@ void iegReadRecord(stream_t *streamptr, double *data, size_t *nmiss) ...@@ -57,8 +57,7 @@ void iegReadRecord(stream_t *streamptr, double *data, size_t *nmiss)
void *iegp = streamptr->record->exsep; void *iegp = streamptr->record->exsep;
int status = iegRead(fileID, iegp); int status = iegRead(fileID, iegp);
if ( status != 0 ) if ( status != 0 ) Error("Could not read IEG record!");
Error("Could not read IEG record!");
iegInqDataDP(iegp, data); iegInqDataDP(iegp, data);
...@@ -448,7 +447,6 @@ void iegCopyRecord(stream_t *streamptr2, stream_t *streamptr1) ...@@ -448,7 +447,6 @@ void iegCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
void iegDefRecord(stream_t *streamptr) void iegDefRecord(stream_t *streamptr)
{ {
Record *record = streamptr->record; Record *record = streamptr->record;
iegrec_t *iegp = (iegrec_t*) record->exsep;
int vlistID = streamptr->vlistID; int vlistID = streamptr->vlistID;
int byteorder = streamptr->byteorder; int byteorder = streamptr->byteorder;
...@@ -460,6 +458,7 @@ void iegDefRecord(stream_t *streamptr) ...@@ -460,6 +458,7 @@ void iegDefRecord(stream_t *streamptr)
int gridID = vlistInqVarGrid(vlistID, varID); int gridID = vlistInqVarGrid(vlistID, varID);
int zaxisID = vlistInqVarZaxis(vlistID, varID); int zaxisID = vlistInqVarZaxis(vlistID, varID);
iegrec_t *iegp = (iegrec_t*) record->exsep;
iegInitMem(iegp); iegInitMem(iegp);
for ( int i = 0; i < 37; i++ ) iegp->ipdb[i] = -1; for ( int i = 0; i < 37; i++ ) iegp->ipdb[i] = -1;
...@@ -616,8 +615,7 @@ void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vc ...@@ -616,8 +615,7 @@ void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vc
int datatype = iegInqDatatype(prec); int datatype = iegInqDatatype(prec);
int varID; int varID, levelID = 0;
int levelID = 0;
varAddRecord(recID, param, gridID, leveltype, lbounds, level1, level2, 0, 0, varAddRecord(recID, param, gridID, leveltype, lbounds, level1, level2, 0, 0,
datatype, &varID, &levelID, TSTEP_INSTANT, 0, 0, -1, datatype, &varID, &levelID, TSTEP_INSTANT, 0, 0, -1,
NULL, NULL, NULL, NULL, NULL, NULL, 0); NULL, NULL, NULL, NULL, NULL, NULL, 0);
...@@ -687,10 +685,9 @@ void iegScanTimestep1(stream_t *streamptr) ...@@ -687,10 +685,9 @@ void iegScanTimestep1(stream_t *streamptr)
streamptr->curTsID = 0; streamptr->curTsID = 0;
int tsID = tstepsNewEntry(streamptr); int tsID = tstepsNewEntry(streamptr);
taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
if ( tsID != 0 ) if ( tsID != 0 )
Error("Internal problem! tstepsNewEntry returns %d", tsID); Error("Internal problem! tstepsNewEntry returns %d", tsID);
taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
int fileID = streamptr->fileID; int fileID = streamptr->fileID;
...@@ -781,7 +778,7 @@ void iegScanTimestep1(stream_t *streamptr) ...@@ -781,7 +778,7 @@ void iegScanTimestep1(stream_t *streamptr)
if ( streamptr->ntsteps == -1 ) if ( streamptr->ntsteps == -1 )
{ {
tsID = tstepsNewEntry(streamptr); int tsID = tstepsNewEntry(streamptr);
if ( tsID != streamptr->rtsteps ) if ( tsID != streamptr->rtsteps )
Error("Internal error. tsID = %d", tsID); Error("Internal error. tsID = %d", tsID);
...@@ -937,7 +934,7 @@ int iegScanTimestep2(stream_t *streamptr) ...@@ -937,7 +934,7 @@ int iegScanTimestep2(stream_t *streamptr)
if ( streamptr->ntsteps == -1 ) if ( streamptr->ntsteps == -1 )
{ {
tsID = tstepsNewEntry(streamptr); int tsID = tstepsNewEntry(streamptr);
if ( tsID != streamptr->rtsteps ) if ( tsID != streamptr->rtsteps )
Error("Internal error. tsID = %d", tsID); Error("Internal error. tsID = %d", tsID);
...@@ -951,16 +948,13 @@ int iegScanTimestep2(stream_t *streamptr) ...@@ -951,16 +948,13 @@ int iegScanTimestep2(stream_t *streamptr)
int iegInqContents(stream_t *streamptr) int iegInqContents(stream_t *streamptr)
{ {
int fileID = streamptr->fileID;
streamptr->curTsID = 0; streamptr->curTsID = 0;
iegScanTimestep1(streamptr); iegScanTimestep1(streamptr);
int status = 0; int status = (streamptr->ntsteps == -1) ? iegScanTimestep2(streamptr) : 0;
if ( streamptr->ntsteps == -1 ) status = iegScanTimestep2(streamptr);
fileSetPos(fileID, 0, SEEK_SET); fileSetPos(streamptr->fileID, 0, SEEK_SET);
return status; return status;
} }
......
...@@ -92,8 +92,7 @@ void srvReadRecord(stream_t *streamptr, double *data, size_t *nmiss) ...@@ -92,8 +92,7 @@ void srvReadRecord(stream_t *streamptr, double *data, size_t *nmiss)
void *srvp = streamptr->record->exsep; void *srvp = streamptr->record->exsep;
int status = srvRead(fileID, srvp); int status = srvRead(fileID, srvp);
if ( status != 0 ) if ( status != 0 ) Error("Failed to read record from SRV file");
Error("Failed to read record from SRV file");
int header[8]; int header[8];
srvInqHeader(srvp, header); srvInqHeader(srvp, header);
...@@ -124,7 +123,6 @@ void srvCopyRecord(stream_t *streamptr2, stream_t *streamptr1) ...@@ -124,7 +123,6 @@ void srvCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
void srvDefRecord(stream_t *streamptr) void srvDefRecord(stream_t *streamptr)
{ {
Record *record = streamptr->record; Record *record = streamptr->record;
srvrec_t *srvp = (srvrec_t*) record->exsep;
int pdis, pcat, pnum; int pdis, pcat, pnum;
cdiDecodeParam(record->param, &pnum, &pcat, &pdis); cdiDecodeParam(record->param, &pnum, &pcat, &pdis);
...@@ -154,8 +152,8 @@ void srvDefRecord(stream_t *streamptr) ...@@ -154,8 +152,8 @@ void srvDefRecord(stream_t *streamptr)
header[6] = 0; header[6] = 0;
header[7] = 0; header[7] = 0;
int datatype = record->prec; srvrec_t *srvp = (srvrec_t*) record->exsep;
srvp->dprec = srvDefDatatype(datatype); srvp->dprec = srvDefDatatype(record->prec);
srvDefHeader(srvp, header); srvDefHeader(srvp, header);
} }
...@@ -163,11 +161,9 @@ void srvDefRecord(stream_t *streamptr) ...@@ -163,11 +161,9 @@ void srvDefRecord(stream_t *streamptr)
void srvWriteRecord(stream_t *streamptr, const double *data) void srvWriteRecord(stream_t *streamptr, const double *data)
{ {
int fileID = streamptr->fileID;
void *srvp = streamptr->record->exsep; void *srvp = streamptr->record->exsep;
srvDefDataDP(srvp, data); srvDefDataDP(srvp, data);
srvWrite(fileID, srvp); srvWrite(streamptr->fileID, srvp);
} }
static static
...@@ -192,16 +188,11 @@ void srv_add_record(stream_t *streamptr, int param, int level, size_t xsize, siz ...@@ -192,16 +188,11 @@ void srv_add_record(stream_t *streamptr, int param, int level, size_t xsize, siz
struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0);
int gridID = gridAdded.Id; int gridID = gridAdded.Id;
if (!gridAdded.isNew) Free(grid); if (!gridAdded.isNew) Free(grid);
/*
if ( level == 0 ) leveltype = ZAXIS_SURFACE;
else leveltype = ZAXIS_GENERIC;
*/
int leveltype = ZAXIS_GENERIC;
int leveltype = ZAXIS_GENERIC;
int datatype = srvInqDatatype(prec); int datatype = srvInqDatatype(prec);
int levelID = 0; int varID, levelID = 0;
int varID;
varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0, varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0,
datatype, &varID, &levelID, TSTEP_INSTANT, 0, 0, -1, datatype, &varID, &levelID, TSTEP_INSTANT, 0, 0, -1,
NULL, NULL, NULL, NULL, NULL, NULL, 0); NULL, NULL, NULL, NULL, NULL, NULL, 0);
...@@ -222,17 +213,14 @@ void srvScanTimestep1(stream_t *streamptr) ...@@ -222,17 +213,14 @@ void srvScanTimestep1(stream_t *streamptr)
{ {
DateTime datetime0 = { LONG_MIN, LONG_MIN }; DateTime datetime0 = { LONG_MIN, LONG_MIN };
off_t recpos; off_t recpos;
taxis_t *taxis;
srvrec_t *srvp = (srvrec_t*) streamptr->record->exsep; srvrec_t *srvp = (srvrec_t*) streamptr->record->exsep;
streamptr->curTsID = 0; streamptr->curTsID = 0;
{ int tsID = tstepsNewEntry(streamptr);
int tsID = tstepsNewEntry(streamptr); if ( tsID != 0 )
if ( tsID != 0 ) Error("Internal problem! tstepsNewEntry returns %d", tsID);
Error("Internal problem! tstepsNewEntry returns %d", tsID); taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
taxis = &streamptr->tsteps[tsID].taxis;
}
int fileID = streamptr->fileID; int fileID = streamptr->fileID;
...@@ -407,7 +395,7 @@ int srvScanTimestep2(stream_t *streamptr) ...@@ -407,7 +395,7 @@ int srvScanTimestep2(stream_t *streamptr)
int recID; int recID;
for ( recID = 0; recID < nrecords; recID++ ) for ( recID = 0; recID < nrecords; recID++ )
{ {
compVar0.param = streamptr->tsteps[tsID].records[recID].param; compVar0.param = streamptr->tsteps[tsID].records[recID].param;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel; compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(srvcompvar_t)) == 0 ) if ( memcmp(&compVar0, &compVar, sizeof(srvcompvar_t)) == 0 )
...@@ -437,7 +425,7 @@ int srvScanTimestep2(stream_t *streamptr) ...@@ -437,7 +425,7 @@ int srvScanTimestep2(stream_t *streamptr)
streamptr->tsteps[tsID].records[recID].size = recsize;