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

Added streamScanTimeConstAdjust().

parent 6d9469c6
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "file.h" #include "file.h"
#include "varscan.h" #include "varscan.h"
#include "datetime.h" #include "datetime.h"
#include "stream_scan.h"
#include "stream_grb.h" #include "stream_grb.h"
#include "stream_cgribex.h" #include "stream_cgribex.h"
...@@ -716,21 +717,6 @@ void cgribexScanTsFixNtsteps(stream_t *streamptr, off_t recpos) ...@@ -716,21 +717,6 @@ void cgribexScanTsFixNtsteps(stream_t *streamptr, off_t recpos)
} }
} }
static inline
void cgribexScanTsConstAdjust(stream_t *streamptr, taxis_t *taxis)
{
const int vlistID = streamptr->vlistID;
if ( streamptr->ntsteps == 1 )
{
if ( taxis->vdate == 0 && taxis->vtime == 0 )
{
streamptr->ntsteps = 0;
for ( int varID = 0; varID < streamptr->nvars; varID++ )
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
}
}
}
static static
void cgribexSkipRecords(const int fileID) void cgribexSkipRecords(const int fileID)
{ {
...@@ -911,7 +897,7 @@ int cgribexScanTimestep1(stream_t *streamptr) ...@@ -911,7 +897,7 @@ int cgribexScanTimestep1(stream_t *streamptr)
streamptr->record->buffersize = buffersize; streamptr->record->buffersize = buffersize;
cgribexScanTsFixNtsteps(streamptr, recpos); cgribexScanTsFixNtsteps(streamptr, recpos);
cgribexScanTsConstAdjust(streamptr, taxis); streamScanTimeConstAdjust(streamptr, taxis);
return 0; return 0;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "file.h" #include "file.h"
#include "cdi.h" #include "cdi.h"
#include "cdi_int.h" #include "cdi_int.h"
#include "stream_scan.h"
#include "stream_ext.h" #include "stream_ext.h"
#include "varscan.h" #include "varscan.h"
#include "datetime.h" #include "datetime.h"
...@@ -318,15 +319,7 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -318,15 +319,7 @@ void extScanTimestep1(stream_t *streamptr)
streamptr->tsteps[tsID].position = recpos; streamptr->tsteps[tsID].position = recpos;
} }
if ( streamptr->ntsteps == 1 ) streamScanTimeConstAdjust(streamptr, taxis);
{
if ( taxis->vdate == 0 && taxis->vtime == 0 )
{
streamptr->ntsteps = 0;
for ( int varID = 0; varID < streamptr->nvars; varID++ )
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
}
}
} }
static static
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "cdi_int.h" #include "cdi_int.h"
#include "file.h" #include "file.h"
#include "gribapi_utilities.h" #include "gribapi_utilities.h"
#include "stream_scan.h"
#include "stream_grb.h" #include "stream_grb.h"
#include "stream_gribapi.h" #include "stream_gribapi.h"
#include "varscan.h" #include "varscan.h"
...@@ -93,14 +94,11 @@ static ...@@ -93,14 +94,11 @@ static
int gribapiGetTimeUnits(grib_handle *gh) int gribapiGetTimeUnits(grib_handle *gh)
{ {
long unitsOfTime = -1; long unitsOfTime = -1;
grib_get_long(gh, "indicatorOfUnitOfTimeRange", &unitsOfTime); grib_get_long(gh, "indicatorOfUnitOfTimeRange", &unitsOfTime);
GRIB_CHECK(my_grib_set_long(gh, "stepUnits", unitsOfTime), 0); GRIB_CHECK(my_grib_set_long(gh, "stepUnits", unitsOfTime), 0);
int timeunits = getTimeunits(unitsOfTime); return getTimeunits(unitsOfTime);
return timeunits;
} }
static static
...@@ -1078,15 +1076,7 @@ int gribapiScanTimestep1(stream_t * streamptr) ...@@ -1078,15 +1076,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
streamptr->tsteps[tsID].position = recpos; streamptr->tsteps[tsID].position = recpos;
} }
if ( streamptr->ntsteps == 1 ) streamScanTimeConstAdjust(streamptr, taxis);
{
if ( taxis->vdate == 0 && taxis->vtime == 0 )
{
streamptr->ntsteps = 0;
for ( int varID = 0; varID < streamptr->nvars; varID++ )
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
}
}
return 0; return 0;
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "varscan.h" #include "varscan.h"
#include "datetime.h" #include "datetime.h"
#include "ieg.h" #include "ieg.h"
#include "stream_scan.h"
#include "stream_ieg.h" #include "stream_ieg.h"
#include "exse.h" #include "exse.h"
...@@ -786,15 +787,7 @@ void iegScanTimestep1(stream_t *streamptr) ...@@ -786,15 +787,7 @@ void iegScanTimestep1(stream_t *streamptr)
streamptr->tsteps[tsID].position = recpos; streamptr->tsteps[tsID].position = recpos;
} }
if ( streamptr->ntsteps == 1 ) streamScanTimeConstAdjust(streamptr, taxis);
{
if ( taxis->vdate == 0 && taxis->vtime == 0 )
{
streamptr->ntsteps = 0;
for ( int varID = 0; varID < streamptr->nvars; varID++ )
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
}
}
} }
static static
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
void streamScanTimeConstAdjust(stream_t *streamptr, const taxis_t *taxis) void streamScanTimeConstAdjust(stream_t *streamptr, const taxis_t *taxis)
{ {
const int vlistID = streamptr->vlistID; const int vlistID = streamptr->vlistID;
if ( streamptr->ntsteps == 1 ) if (streamptr->ntsteps == 1)
{ {
if ( taxis->vdate == 0 && taxis->vtime == 0 ) if (taxis->vdate == 0 && taxis->vtime == 0)
{ {
streamptr->ntsteps = 0; streamptr->ntsteps = 0;
for ( int varID = 0; varID < streamptr->nvars; varID++ ) for (int varID = 0; varID < streamptr->nvars; ++varID)
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT); vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
} }
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "varscan.h" #include "varscan.h"
#include "datetime.h" #include "datetime.h"
#include "service.h" #include "service.h"
#include "stream_scan.h"
#include "stream_srv.h" #include "stream_srv.h"
#include "exse.h" #include "exse.h"
...@@ -314,15 +315,7 @@ void srvScanTimestep1(stream_t *streamptr) ...@@ -314,15 +315,7 @@ void srvScanTimestep1(stream_t *streamptr)
streamptr->tsteps[tsID].position = recpos; streamptr->tsteps[tsID].position = recpos;
} }
if ( streamptr->ntsteps == 1 ) streamScanTimeConstAdjust(streamptr, taxis);
{
if ( taxis->vdate == 0 && taxis->vtime == 0 )
{
streamptr->ntsteps = 0;
for ( int varID = 0; varID < streamptr->nvars; varID++ )
vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT);
}
}
} }
static static
......
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