Commit 5e05b455 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

add function vlistXXXVarTimacc

parent 4037990e
......@@ -8,6 +8,7 @@
* grbDefGrid: add warning for curvilinear grids
* grbDefGrid: set increment for zonal means [request: Helmut P. Frank]
* ptaxisCopy: don't overwrite item 'self' (bug fix)
* add function vlistXXXVarTimaccu
* DBL_IS_EQUAL: check NaN with isnan
* Version 1.2.0 released
......
......@@ -375,8 +375,10 @@ void vlistDefVarScalefactor(int vlistID, int varID, double scalefactor);
double vlistInqVarScalefactor(int vlistID, int varID);
void vlistDefVarAddoffset(int vlistID, int varID, double addoffset);
double vlistInqVarAddoffset(int vlistID, int varID);
void vlistDefVarAverage(int vlistID, int varID, int average);
int vlistInqVarAverage(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);
int vlistInqVarTimaccu(int vlistID, int varID);
int vlistInqVarSize(int vlistID, int varID);
int vlistInqVarID(int vlistID, int code);
......
......@@ -28,6 +28,8 @@
PARAMETER (CDI_ELIBNAVAIL = -22)
INTEGER CDI_EUFSTRUCT
PARAMETER (CDI_EUFSTRUCT = -23)
INTEGER CDI_EUNC4
PARAMETER (CDI_EUNC4 = -24)
!
! File types
!
......@@ -139,6 +141,12 @@
PARAMETER (DATATYPE_INT16 = 216)
INTEGER DATATYPE_INT32
PARAMETER (DATATYPE_INT32 = 232)
INTEGER DATATYPE_UINT8
PARAMETER (DATATYPE_UINT8 = 308)
INTEGER DATATYPE_UINT16
PARAMETER (DATATYPE_UINT16 = 316)
INTEGER DATATYPE_UINT32
PARAMETER (DATATYPE_UINT32 = 332)
!
! internal data types
!
......@@ -774,16 +782,27 @@
! INTEGER varID)
EXTERNAL vlistInqVarAddoffset
! vlistDefVarAverage
! vlistDefVarTimave
! (INTEGER vlistID,
! INTEGER varID,
! INTEGER average)
EXTERNAL vlistDefVarAverage
! INTEGER timave)
EXTERNAL vlistDefVarTimave
INTEGER vlistInqVarAverage
INTEGER vlistInqVarTimave
! (INTEGER vlistID,
! INTEGER varID)
EXTERNAL vlistInqVarAverage
EXTERNAL vlistInqVarTimave
! vlistDefVarTimaccu
! (INTEGER vlistID,
! INTEGER varID,
! INTEGER timaccu)
EXTERNAL vlistDefVarTimaccu
INTEGER vlistInqVarTimaccu
! (INTEGER vlistID,
! INTEGER varID)
EXTERNAL vlistInqVarTimaccu
INTEGER vlistInqVarSize
! (INTEGER vlistID,
......@@ -1293,7 +1312,7 @@
!
! zaxisName
! (INTEGER zaxistype,
! CHARACTER*(*) gridname)
! CHARACTER*(*) zaxisname)
EXTERNAL zaxisName
INTEGER zaxisCreate
......
......@@ -167,8 +167,10 @@ FCALLSCSUB3 (vlistDefVarScalefactor, VLISTDEFVARSCALEFACTOR, vlistdefvarscalefac
FCALLSCFUN2 (DOUBLE, vlistInqVarScalefactor, VLISTINQVARSCALEFACTOR, vlistinqvarscalefactor, INT, INT)
FCALLSCSUB3 (vlistDefVarAddoffset, VLISTDEFVARADDOFFSET, vlistdefvaraddoffset, INT, INT, DOUBLE)
FCALLSCFUN2 (DOUBLE, vlistInqVarAddoffset, VLISTINQVARADDOFFSET, vlistinqvaraddoffset, INT, INT)
FCALLSCSUB3 (vlistDefVarAverage, VLISTDEFVARAVERAGE, vlistdefvaraverage, INT, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarAverage, VLISTINQVARAVERAGE, vlistinqvaraverage, INT, INT)
FCALLSCSUB3 (vlistDefVarTimave, VLISTDEFVARTIMAVE, vlistdefvartimave, INT, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarTimave, VLISTINQVARTIMAVE, vlistinqvartimave, INT, INT)
FCALLSCSUB3 (vlistDefVarTimaccu, VLISTDEFVARTIMACCU, vlistdefvartimaccu, INT, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarTimaccu, VLISTINQVARTIMACCU, vlistinqvartimaccu, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarSize, VLISTINQVARSIZE, vlistinqvarsize, INT, INT)
FCALLSCFUN2 (INT, vlistInqVarID, VLISTINQVARID, vlistinqvarid, INT, INT)
FCALLSCSUB4 (vlistDefIndex, VLISTDEFINDEX, vlistdefindex, INT, INT, INT, INT)
......
......@@ -2278,7 +2278,7 @@ void grbWriteVarDP(int streamID, int varID, const double *data, int nmiss)
code = vlistInqVarCode(vlistID, varID);
date = streamptr->tsteps[tsID].taxis.vdate;
time = streamptr->tsteps[tsID].taxis.vtime;
if ( vlistInqVarAverage(vlistID, varID) )
if ( vlistInqVarTimave(vlistID, varID) )
numavg = streamptr->tsteps[tsID].taxis.numavg;
datasize = gridInqSize(gridID);
......@@ -2404,7 +2404,7 @@ void grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data
code = vlistInqVarCode(vlistID, varID);
date = streamptr->tsteps[tsID].taxis.vdate;
time = streamptr->tsteps[tsID].taxis.vtime;
if ( vlistInqVarAverage(vlistID, varID) )
if ( vlistInqVarTimave(vlistID, varID) )
numavg = streamptr->tsteps[tsID].taxis.numavg;
datasize = gridInqSize(gridID);
......@@ -2596,7 +2596,7 @@ int grbWriteRecord(int streamID, const double *data, int nmiss)
code = vlistInqVarCode(vlistID, varID);
date = streamptr->tsteps[tsID].taxis.vdate;
time = streamptr->tsteps[tsID].taxis.vtime;
if ( vlistInqVarAverage(vlistID, varID) )
if ( vlistInqVarTimave(vlistID, varID) )
numavg = streamptr->tsteps[tsID].taxis.numavg;
datasize = gridInqSize(gridID);
......
......@@ -30,7 +30,8 @@ typedef struct
{
int code;
int prec;
int average;
int timave;
int timaccu;
int gridID;
int zaxistype;
int ltype; /* GRIB level type */
......@@ -59,7 +60,8 @@ static void codeInitEntry(int varID, int code)
{
vartable[varID].code = code;
vartable[varID].prec = 0;
vartable[varID].average = 0;
vartable[varID].timave = 0;
vartable[varID].timaccu = 0;
vartable[varID].gridID = UNDEFID;
vartable[varID].zaxistype = 0;
vartable[varID].ltype = 0;
......@@ -264,7 +266,7 @@ void varAddRecord(int recID, int code, int gridID, int zaxistype, int lbounds,
vartable[varID].zaxistype = zaxistype;
vartable[varID].ltype = ltype;
vartable[varID].lbounds = lbounds;
if ( numavg ) vartable[varID].average = 1;
if ( numavg ) vartable[varID].timave = 1;
vartable[varID].codetable = codetable;
}
else
......@@ -325,7 +327,7 @@ void cdiGenVars(int streamID)
int instID, modelID, tableID;
int code, nlevels, zaxistype, lindex, ltype;
int prec;
int average;
int timave, timaccu;
int lbounds;
int ztype;
char name[256], longname[256], units[256];
......@@ -353,7 +355,8 @@ void cdiGenVars(int streamID)
instID = vartable[varID].instID;
modelID = vartable[varID].modelID;
tableID = vartable[varID].tableID;
average = vartable[varID].average;
timave = vartable[varID].timave;
timaccu = vartable[varID].timaccu;
ztype = vartable[varID].ztype;
zaxisID = UNDEFID;
......@@ -431,7 +434,8 @@ void cdiGenVars(int streamID)
vlistDefVarCode(vlistID, varID, code);
vlistDefVarDatatype(vlistID, varID, prec);
vlistDefVarAverage(vlistID, varID, average);
vlistDefVarTimave(vlistID, varID, timave);
vlistDefVarTimaccu(vlistID, varID, timaccu);
vlistDefVarZtype(vlistID, varID, ztype);
if ( cdiDefaultTableID != UNDEFID )
......
......@@ -52,7 +52,8 @@ typedef struct
int instID;
int modelID;
int tableID;
int average;
int timave;
int timaccu;
int func;
int missvalused; /* TRUE if missval is defined */
char *name;
......
......@@ -19,7 +19,8 @@ static void vlistvarInitEntry(int vlistID, int varID)
vlistptr->vars[varID].code = 0;
vlistptr->vars[varID].timeID = CDI_UNDEFID;
vlistptr->vars[varID].datatype = CDI_UNDEFID;
vlistptr->vars[varID].average = 0;
vlistptr->vars[varID].timave = 0;
vlistptr->vars[varID].timaccu = 0;
vlistptr->vars[varID].gridID = CDI_UNDEFID;
vlistptr->vars[varID].zaxisID = CDI_UNDEFID;
vlistptr->vars[varID].instID = CDI_UNDEFID;
......@@ -956,6 +957,7 @@ void vlistDefVarScalefactor(int vlistID, int varID, double scalefactor)
vlistptr->vars[varID].scalefactor = scalefactor;
}
void vlistDefVarAddoffset(int vlistID, int varID, double addoffset)
{
static char func[] = "vlistDefVarAddoffset";
......@@ -968,24 +970,47 @@ void vlistDefVarAddoffset(int vlistID, int varID, double addoffset)
vlistptr->vars[varID].addoffset = addoffset;
}
void vlistDefVarAverage(int vlistID, int varID, int average)
void vlistDefVarTimave(int vlistID, int varID, int timave)
{
VLIST *vlistptr;
vlistptr = vlist_to_pointer(vlistID);
vlistptr->vars[varID].timave = timave;
}
int vlistInqVarTimave(int vlistID, int varID)
{
VLIST *vlistptr;
vlistptr = vlist_to_pointer(vlistID);
return (vlistptr->vars[varID].timave);
}
void vlistDefVarTimaccu(int vlistID, int varID, int timaccu)
{
VLIST *vlistptr;
vlistptr = vlist_to_pointer(vlistID);
vlistptr->vars[varID].average = average;
vlistptr->vars[varID].timaccu = timaccu;
}
int vlistInqVarAverage(int vlistID, int varID)
int vlistInqVarTimaccu(int vlistID, int varID)
{
VLIST *vlistptr;
vlistptr = vlist_to_pointer(vlistID);
return (vlistptr->vars[varID].average);
return (vlistptr->vars[varID].timaccu);
}
void vlistDestroyVarName(int vlistID, int varID)
{
static char func[] = "vlistDestroyVarName";
......
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