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

Added streamScanTimeConstAdjust().

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