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

added support for grib_api key stepType

parent a5d8d2b5
2012-06-06 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support for grib_api key stepType [request: Drte Liermann]
2012-06-01 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* stream_gribapi: added support for level type HYBRID_HALF [request: Drte Liermann]
......
......@@ -268,7 +268,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
int nrecs, nvars, nzaxis, ntsteps;
int levelID, levelsize;
int tsID, ntimeout;
int timeID, taxisID;
int tstepID, taxisID;
int nbyte, nbyte0;
int index;
char varname[CDI_MAX_NAME];
......@@ -286,10 +286,10 @@ void printShortinfo(int streamID, int vlistID, int vardis)
if ( vardis )
fprintf(stdout,
" Var : Institut Source Varname Time Typ Grid Size Num Levels Num\n");
" Var : Institut Source Varname Ttype Dtype Gridsize Num Levels Num\n");
else
fprintf(stdout,
" Var : Institut Source Param Time Typ Grid Size Num Levels Num\n");
" Var : Institut Source Param Ttype Dtype Gridsize Num Levels Num\n");
nvars = vlistNvars(vlistID);
......@@ -324,11 +324,13 @@ void printShortinfo(int streamID, int vlistID, int vardis)
else
fprintf(stdout, "%-12s", paramstr);
timeID = vlistInqVarTime(vlistID, varID);
if ( timeID == TIME_CONSTANT )
fprintf(stdout, "con ");
else
fprintf(stdout, "var ");
tstepID = vlistInqVarTsteptype(vlistID, varID);
if ( tstepID == TSTEP_CONSTANT ) fprintf(stdout, "%-8s", "constant");
else if ( tstepID == TSTEP_INSTANT ) fprintf(stdout, "%-8s", "instant");
else if ( tstepID == TSTEP_MIN ) fprintf(stdout, "%-8s", "min");
else if ( tstepID == TSTEP_MAX ) fprintf(stdout, "%-8s", "max");
else if ( tstepID == TSTEP_ACCUM ) fprintf(stdout, "%-8s", "accum");
else fprintf(stdout, "%-8s", "unknown");
datatype = vlistInqVarDatatype(vlistID, varID);
......
......@@ -154,11 +154,12 @@ extern "C" {
/* TIME types */
#define TIME_CONSTANT 1
#define TIME_VARIABLE 2
#define TIME_CONSTANT 0 /* obsolate, use TSTEP_CONSTANT */
#define TIME_VARIABLE 1 /* obsolate, use TSTEP_INSTANT */
/* TSTEP types */
#define TSTEP_CONSTANT 0
#define TSTEP_INSTANT 1
#define TSTEP_AVG 2
#define TSTEP_ACCUM 3
......@@ -381,17 +382,19 @@ int vlistInqModel(int vlistID);
/* VLIST VAR routines */
/* vlistDefVar: Create a new Variable */
int vlistDefVar(int vlistID, int gridID, int zaxisID, int timeID);
int vlistDefVar(int vlistID, int gridID, int zaxisID, int tsteptype);
void vlistChangeVarGrid(int vlistID, int varID, int gridID);
void vlistChangeVarZaxis(int vlistID, int varID, int zaxisID);
void vlistInqVar(int vlistID, int varID, int *gridID, int *zaxisID, int *timeID);
void vlistInqVar(int vlistID, int varID, int *gridID, int *zaxisID, int *tsteptype);
int vlistInqVarGrid(int vlistID, int varID);
int vlistInqVarZaxis(int vlistID, int varID);
int vlistInqVarTime(int vlistID, int varID);
void vlistDefVarTime(int vlistID, int varID, int timeID);
int vlistInqVarTsteptype(int vlistID, int varID);
void vlistDefVarTsteptype(int vlistID, int varID, int tsteptype);
void vlistDefVarCompType(int vlistID, int varID, int comptype);
int vlistInqVarCompType(int vlistID, int varID);
......@@ -463,8 +466,6 @@ double vlistInqVarScalefactor(int vlistID, int varID);
void vlistDefVarAddoffset(int vlistID, int varID, double addoffset);
double vlistInqVarAddoffset(int vlistID, int varID);
void vlistDefVarTsteptype(int vlistID, int varID, int tsteptype);
int vlistInqVarTsteptype(int vlistID, int varID);
void vlistDefVarTimave(int vlistID, int varID, int timave);
int vlistInqVarTimave(int vlistID, int varID);
void vlistDefVarTimaccu(int vlistID, int varID, int timaccu);
......
......@@ -4,7 +4,7 @@
!
! Author:
! -------
! Uwe Schulzweida, MPI-MET, Hamburg, May 2012
! Uwe Schulzweida, MPI-MET, Hamburg, June 2012
!
INTEGER CDI_MAX_NAME
......@@ -254,13 +254,6 @@
INTEGER ZAXIS_REFERENCE
PARAMETER (ZAXIS_REFERENCE = 16)
!
! TAXIS types
!
INTEGER TAXIS_ABSOLUTE
PARAMETER (TAXIS_ABSOLUTE = 1)
INTEGER TAXIS_RELATIVE
PARAMETER (TAXIS_RELATIVE = 2)
!
! TIME types
!
INTEGER TIME_CONSTANT
......@@ -268,6 +261,36 @@
INTEGER TIME_VARIABLE
PARAMETER (TIME_VARIABLE = 2)
!
! TSTEP types
!
INTEGER TSTEP_CONSTANT
PARAMETER (TSTEP_CONSTANT = 0)
INTEGER TSTEP_INSTANT
PARAMETER (TSTEP_INSTANT = 1)
INTEGER TSTEP_AVG
PARAMETER (TSTEP_AVG = 2)
INTEGER TSTEP_ACCUM
PARAMETER (TSTEP_ACCUM = 3)
INTEGER TSTEP_MAX
PARAMETER (TSTEP_MAX = 4)
INTEGER TSTEP_MIN
PARAMETER (TSTEP_MIN = 5)
INTEGER TSTEP_DIFF
PARAMETER (TSTEP_DIFF = 6)
INTEGER TSTEP_RANGE
PARAMETER (TSTEP_RANGE = 7)
INTEGER TSTEP_INSTANT2
PARAMETER (TSTEP_INSTANT2 = 8)
INTEGER TSTEP_INSTANT3
PARAMETER (TSTEP_INSTANT3 = 9)
!
! TAXIS types
!
INTEGER TAXIS_ABSOLUTE
PARAMETER (TAXIS_ABSOLUTE = 1)
INTEGER TAXIS_RELATIVE
PARAMETER (TAXIS_RELATIVE = 2)
!
! TUNIT types
!
INTEGER TUNIT_SECOND
......@@ -291,27 +314,6 @@
INTEGER TUNIT_12HOURS
PARAMETER (TUNIT_12HOURS = 10)
!
! TSTEP types
!
INTEGER TSTEP_INSTANT
PARAMETER (TSTEP_INSTANT = 1)
INTEGER TSTEP_AVG
PARAMETER (TSTEP_AVG = 2)
INTEGER TSTEP_ACCUM
PARAMETER (TSTEP_ACCUM = 3)
INTEGER TSTEP_MAX
PARAMETER (TSTEP_MAX = 4)
INTEGER TSTEP_MIN
PARAMETER (TSTEP_MIN = 5)
INTEGER TSTEP_DIFF
PARAMETER (TSTEP_DIFF = 6)
INTEGER TSTEP_RANGE
PARAMETER (TSTEP_RANGE = 7)
INTEGER TSTEP_INSTANT2
PARAMETER (TSTEP_INSTANT2 = 8)
INTEGER TSTEP_INSTANT3
PARAMETER (TSTEP_INSTANT3 = 9)
!
! CALENDAR types
!
INTEGER CALENDAR_STANDARD
......@@ -784,12 +786,6 @@
! INTEGER varID)
EXTERNAL vlistInqVarTime
! vlistDefVarTime
! (INTEGER vlistID,
! INTEGER varID,
! INTEGER timeID)
EXTERNAL vlistDefVarTime
! vlistDefVarCompType
! (INTEGER vlistID,
! INTEGER varID,
......
......@@ -39,16 +39,16 @@
/* ZAXIS types */
/* TAXIS types */
/* TIME types */
/* TIME types */
/* TSTEP types */
/* TUNIT types */
/* TAXIS types */
/* TSTEP types */
/* TUNIT types */
/* CALENDAR types */
......@@ -163,7 +163,6 @@ FCALLSCSUB5 (vlistInqVar, VLISTINQVAR, vlistinqvar, INT, INT, PINT, PINT, PINT)
FCALLSCFUN2 (INT, vlistInqVarGrid, VLISTINQVARGRID, vlistinqvargrid, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarZaxis, VLISTINQVARZAXIS, vlistinqvarzaxis, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarTime, VLISTINQVARTIME, vlistinqvartime, INT, INT)
FCALLSCSUB3 (vlistDefVarTime, VLISTDEFVARTIME, vlistdefvartime, INT, INT, INT)
FCALLSCSUB3 (vlistDefVarCompType, VLISTDEFVARCOMPTYPE, vlistdefvarcomptype, INT, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarCompType, VLISTINQVARCOMPTYPE, vlistinqvarcomptype, INT, INT)
FCALLSCSUB3 (vlistDefVarCompLevel, VLISTDEFVARCOMPLEVEL, vlistdefvarcomplevel, INT, INT, INT)
......
......@@ -1856,7 +1856,7 @@ void streamWriteContents(int streamID, char *cname)
int tsID, recID, varID, levelID;
long recsize;
int nrecs, nvars;
int code, gridID, zaxisID, timeID, datatype;
int code, gridID, zaxisID, tsteptype, datatype;
int ngrids, nzaxis;
int filetype, gridtype;
int xsize, ysize;
......@@ -1899,24 +1899,24 @@ void streamWriteContents(int streamID, char *cname)
fprintf(cnp, "#\n");
fprintf(cnp, "varID:code:gridID:zaxisID:timeID:datatype\n");
fprintf(cnp, "varID:code:gridID:zaxisID:tsteptype:datatype\n");
nvars = vlistNvars(vlistID);
for ( varID = 0; varID < nvars; varID++ )
{
code = vlistInqVarCode(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
timeID = vlistInqVarTime(vlistID, varID);
datatype = vlistInqVarDatatype(vlistID, varID);
code = vlistInqVarCode(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
tsteptype = vlistInqVarTsteptype(vlistID, varID);
datatype = vlistInqVarDatatype(vlistID, varID);
fprintf(cnp, "%4d:%4d:%4d:%4d:%4d:%4d:\n",
varID+1, code, gridID, zaxisID, timeID, datatype);
varID+1, code, gridID, zaxisID, tsteptype, datatype);
}
fprintf(cnp, "#\n");
fprintf(cnp, "tsID:nrecs:date:time\n");
tsID = 0;
while (1)
{
......
......@@ -56,7 +56,7 @@ typedef struct {
int islat;
int islev;
int warn;
int timeID;
int tsteptype;
int param;
int code;
int tabnum;
......@@ -2687,7 +2687,7 @@ int cdfDefVar(int streamID, int varID)
int tableID;
int ndims = 0;
int len;
int timeID;
int tsteptype;
int xtype, dtype;
int gridtype, gridsize;
int gridindex, zaxisindex;
......@@ -2710,12 +2710,12 @@ int cdfDefVar(int streamID, int varID)
if ( streamptr->vars[varID].ncvarid != UNDEFID )
return (streamptr->vars[varID].ncvarid);
vlistID = streamInqVlist(streamID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
timeID = vlistInqVarTime(vlistID, varID);
code = vlistInqVarCode(vlistID, varID);
param = vlistInqVarParam(vlistID, varID);
vlistID = streamInqVlist(streamID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
tsteptype = vlistInqVarTsteptype(vlistID, varID);
code = vlistInqVarCode(vlistID, varID);
param = vlistInqVarParam(vlistID, varID);
cdiDecodeParam(param, &pnum, &pcat, &pdis);
ixyz = vlistInqVarXYZ(vlistID, varID);
......@@ -2749,7 +2749,7 @@ int cdfDefVar(int streamID, int varID)
tid = streamptr->basetime.ncdimid;
if ( timeID == TIME_VARIABLE )
if ( tsteptype != TSTEP_CONSTANT )
{
if ( tid == UNDEFID ) Error("Internal problem, time undefined!");
chunks[ndims] = 1;
......@@ -3136,7 +3136,7 @@ void cdfReadVarDP(int streamID, int varID, double *data, int *nmiss)
size_t count[4];
int ndims = 0;
int idim;
int timeID;
int tsteptype;
int gridindex, zaxisindex;
int vlistID;
int i;
......@@ -3159,9 +3159,9 @@ void cdfReadVarDP(int streamID, int varID, double *data, int *nmiss)
ncvarid = streamptr->vars[varID].ncvarid;
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
timeID = vlistInqVarTime(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
tsteptype = vlistInqVarTsteptype(vlistID, varID);
gridindex = vlistGridIndex(vlistID, gridID);
if ( gridInqType(gridID) == GRID_TRAJECTORY )
......@@ -3177,7 +3177,7 @@ void cdfReadVarDP(int streamID, int varID, double *data, int *nmiss)
zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
zid = streamptr->zaxisID[zaxisindex];
if ( timeID == TIME_VARIABLE )
if ( tsteptype != TSTEP_CONSTANT )
{
start[ndims] = tsID;
count[ndims] = 1;
......@@ -3443,7 +3443,7 @@ void cdf_write_var(int streamID, int varID, int memtype, const void *data, int n
int swapxy = FALSE;
int ndims = 0;
int idim;
int timeID;
int tsteptype;
int gridindex, zaxisindex;
int dtype;
int vlistID;
......@@ -3465,9 +3465,9 @@ void cdf_write_var(int streamID, int varID, int memtype, const void *data, int n
ncvarid = cdfDefVar(streamID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
timeID = vlistInqVarTime(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
tsteptype = vlistInqVarTsteptype(vlistID, varID);
gridindex = vlistGridIndex(vlistID, gridID);
if ( gridInqType(gridID) == GRID_TRAJECTORY )
......@@ -3483,7 +3483,7 @@ void cdf_write_var(int streamID, int varID, int memtype, const void *data, int n
zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
zid = streamptr->zaxisID[zaxisindex];
if ( timeID == TIME_VARIABLE )
if ( tsteptype != TSTEP_CONSTANT )
{
start[ndims] = ntsteps - 1;
count[ndims] = 1;
......@@ -3549,7 +3549,7 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
size_t count[4];
int ndims = 0;
int idim;
int timeID;
int tsteptype;
int gridindex;
int zaxisindex;
int vlistID;
......@@ -3578,10 +3578,10 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
ncvarid = streamptr->vars[varID].ncvarid;
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
timeID = vlistInqVarTime(vlistID, varID);
ixyz = vlistInqVarXYZ(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
tsteptype = vlistInqVarTsteptype(vlistID, varID);
ixyz = vlistInqVarXYZ(vlistID, varID);
if ( ixyz == 0 ) ixyz = 321; // ZYX
gridsize = gridInqSize(gridID);
......@@ -3621,7 +3621,7 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
printf("dimorder: %d %d %d\n", dimorder[0], dimorder[1], dimorder[2]);
*/
if ( timeID == TIME_VARIABLE )
if ( tsteptype != TSTEP_CONSTANT )
{
start[ndims] = tsID;
count[ndims] = 1;
......@@ -3749,7 +3749,7 @@ int cdf_write_var_slice(int streamID, int varID, int levelID, int memtype, const
size_t count[4];
int ndims = 0;
int idim;
int timeID;
int tsteptype;
int gridindex, zaxisindex;
int dimorder[3];
int ixyz;
......@@ -3774,10 +3774,10 @@ int cdf_write_var_slice(int streamID, int varID, int levelID, int memtype, const
ncvarid = cdfDefVar(streamID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
timeID = vlistInqVarTime(vlistID, varID);
ixyz = vlistInqVarXYZ(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
tsteptype = vlistInqVarTsteptype(vlistID, varID);
ixyz = vlistInqVarXYZ(vlistID, varID);
if ( ixyz == 0 ) ixyz = 321; // ZYX
gridindex = vlistGridIndex(vlistID, gridID);
......@@ -3805,7 +3805,7 @@ int cdf_write_var_slice(int streamID, int varID, int levelID, int memtype, const
printf("dimorder: %d %d %d\n", dimorder[0], dimorder[1], dimorder[2]);
*/
if ( timeID == TIME_VARIABLE )
if ( tsteptype != TSTEP_CONSTANT )
{
start[ndims] = ntsteps - 1;
count[ndims] = 1;
......@@ -3913,7 +3913,7 @@ void cdfCreateRecords(int streamID, int tsID)
nvrecs = 0;
for ( varID = 0; varID < nvars; varID++ )
{
if ( vlistInqVarTime(vlistID, varID) == TIME_VARIABLE )
if ( vlistInqVarTsteptype(vlistID, varID) != TSTEP_CONSTANT )
{
zaxisID = vlistInqVarZaxis(vlistID, varID);
nvrecs += zaxisInqSize(zaxisID);
......@@ -3941,7 +3941,7 @@ void cdfCreateRecords(int streamID, int tsID)
for ( recID = 0; recID < nrecs; recID++ )
{
varID = records[recID].varID;
if ( vlistInqVarTime(vlistID, varID) == TIME_VARIABLE )
if ( vlistInqVarTsteptype(vlistID, varID) != TSTEP_CONSTANT )
{
recIDs[vrecID++] = recID;
}
......@@ -4060,7 +4060,7 @@ void init_ncvars(long nvars, ncvar_t *ncvars)
ncvars[ncvarid].islat = FALSE;
ncvars[ncvarid].islev = FALSE;
ncvars[ncvarid].warn = FALSE;
ncvars[ncvarid].timeID = TIME_CONSTANT;
ncvars[ncvarid].tsteptype = TSTEP_CONSTANT;
ncvars[ncvarid].param = UNDEFID;
ncvars[ncvarid].code = UNDEFID;
ncvars[ncvarid].tabnum = 0;
......@@ -4415,7 +4415,7 @@ void cdfScanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdim
if ( nvdims > 0 )
if ( timedimid == dimidsp[0] )
{
ncvars[ncvarid].timeID = TIME_VARIABLE;
ncvars[ncvarid].tsteptype = TSTEP_INSTANT;
cdfSetDim(ncvars, ncvarid, 0, T_AXIS);
}
......@@ -5929,7 +5929,7 @@ void define_all_vars(int fileID, int streamID, int vlistID, int instID, int mode
zaxisID = ncvars[ncvarid].zaxisID;
varID = streamNewVar(streamID, gridID, zaxisID);
varID = vlistDefVar(vlistID, gridID, zaxisID, ncvars[ncvarid].timeID);
varID = vlistDefVar(vlistID, gridID, zaxisID, ncvars[ncvarid].tsteptype);
#if defined (HAVE_NETCDF4)
if ( ncvars[ncvarid].deflate )
......@@ -5987,7 +5987,7 @@ void define_all_vars(int fileID, int streamID, int vlistID, int instID, int mode
int ixyz = 0;
int ipow10[4] = {1, 10, 100, 1000};
if ( ncvars[ncvarid].timeID == TIME_VARIABLE ) iodim++;
if ( ncvars[ncvarid].tsteptype != TSTEP_CONSTANT ) iodim++;
if ( gridInqType(gridID) == GRID_UNSTRUCTURED && ndims-iodim <= 2 && ydimid == xdimid )
{
......
......@@ -759,7 +759,7 @@ int cgribexScanTimestep1(int streamID)
streamptr->ntsteps = 0;
for ( varID = 0; varID < streamptr->nvars; varID++ )
{
vlistDefVarTime(vlistID, varID, TIME_CONSTANT);
vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
}
}
}
......@@ -909,7 +909,7 @@ int cgribexScanTimestep2(int streamID)
if ( ISEC1_AvgNum )
{
if ( taxis->numavg && warn_numavg &&
(taxis->numavg != ISEC1_AvgNum) )
(taxis->numavg != ISEC1_AvgNum) )
{
/*
Warning("Changing numavg from %d to %d not supported!",
......@@ -1019,7 +1019,7 @@ int cgribexScanTimestep2(int streamID)
if ( ! streamptr->tsteps[tsID].records[recID].used )
{
varID = streamptr->tsteps[tsID].records[recID].varID;
vlistDefVarTime(vlistID, varID, TIME_CONSTANT);
vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
}
else
{
......
......@@ -309,7 +309,7 @@ void extAddRecord(int streamID, int param, int level, int xysize,
leveltype = ZAXIS_GENERIC;
varAddRecord(recID, param, gridID, leveltype, 0, level, 0,
extInqDatatype(prec, number), &varID, &levelID, 0, 0, 0, NULL, NULL, NULL);
extInqDatatype(prec, number), &varID, &levelID, UNDEFID, 0, 0, NULL, NULL, NULL);
(*record).varID = varID;
(*record).levelID = levelID;
......@@ -486,7 +486,7 @@ void extScanTimestep1(int streamID)
streamptr->ntsteps = 0;
for ( varID = 0; varID < streamptr->nvars; varID++ )
{
vlistDefVarTime(vlistID, varID, TIME_CONSTANT);
vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
}
}
}
......@@ -632,7 +632,7 @@ int extScanTimestep2(int streamID)
if ( ! streamptr->tsteps[tsID].records[recID].used )
{
varID = streamptr->tsteps[tsID].records[recID].varID;
vlistDefVarTime(vlistID, varID, TIME_CONSTANT);
vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
}
else
{
......
......@@ -182,35 +182,30 @@ int gribapiTimeIsFC(grib_handle *gh)
static
int gribapiGetTsteptype(grib_handle *gh)
{
int tsteptype = 0;
int timerange;
int tsteptype = TSTEP_INSTANT;
long lpar;
static int lprint = TRUE;
if ( gribapiTimeIsFC(gh) )
{
int status;
status = grib_get_long(gh, "stepType", &lpar);
if ( status == 0 )
size_t len = 256;
char stepType[256];
status = grib_get_string(gh, "stepType", stepType, &len);
if ( status == 0 && len > 1 && len < 256 )
{
timerange = (int) lpar;
// printf("timerange %d\n", timerange);
switch ( timerange )
if ( strncmp("instant", stepType, len) == 0 ) tsteptype = TSTEP_INSTANT;
else if ( strncmp("min", stepType, len) == 0 ) tsteptype = TSTEP_MIN;
else if ( strncmp("max", stepType, len) == 0 ) tsteptype = TSTEP_MAX;
else if ( strncmp("accum", stepType, len) == 0 ) tsteptype = TSTEP_ACCUM;
else if ( lprint )
{
case 0: tsteptype = TSTEP_AVG; break;
case 1: tsteptype = TSTEP_ACCUM; break;
case 2: tsteptype = TSTEP_MIN; break;
case 3: tsteptype = TSTEP_MAX; break;
case 4: tsteptype = TSTEP_DIFF; break;
default:
if ( lprint )
{
Message("Time range %d unsupported", timerange);
lprint = FALSE;
}
Message("stepType %s unsupported, set to instant!", stepType);
lprint = FALSE;
}
// printf("stepType: %s %ld %d\n", stepType, len, tsteptype);
}
}
......@@ -220,10 +215,12 @@ int gribapiGetTsteptype(grib_handle *gh)
#if defined (HAVE_LIBGRIB_API)
static
void gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
int gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
{
int rdate, rtime;
int timeUnits, timePeriod;
int timeUnits, startStep, endStep;
int tstepRange = 0;
int range;
long lpar;
long sigofrtime = 3;
long editionNumber;
......@@ -244,25 +241,29 @@ void gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
}