Commit 45bb8db5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Changed TSTEP_CONSTANT/TSTEP_INSTANT to TIME_CONSTANT/TIME_VARYING.

parent b25025a6
libcdi @ 51151b5b
Subproject commit b8baf9162b363faa8da387d27c84d059a2586e80
Subproject commit 51151b5b3767c64de4cd17dd888d1b8d470e4f50
......@@ -261,7 +261,7 @@ void *Adisit(void *argument)
int vlistID2 = vlistCreate();
int tisID2 = vlistDefVar(vlistID2, gridID, zaxisID, TSTEP_INSTANT);
int tisID2 = vlistDefVar(vlistID2, gridID, zaxisID, TIME_VARYING);
if ( operatorID == ADISIT )
{
vlistDefVarParam(vlistID2, tisID2, cdiEncodeParam(20, 255, 255));
......@@ -280,7 +280,7 @@ void *Adisit(void *argument)
vlistDefVarMissval(vlistID2, tisID2, tis.missval);
vlistDefVarDatatype(vlistID2, tisID2, datatype);
int saoID2 = vlistDefVar(vlistID2, gridID, zaxisID, TSTEP_INSTANT);
int saoID2 = vlistDefVar(vlistID2, gridID, zaxisID, TIME_VARYING);
vlistDefVarParam(vlistID2, saoID2, cdiEncodeParam(5, 255, 255));
vlistDefVarName(vlistID2, saoID2, "s");
vlistDefVarLongname(vlistID2, saoID2, "Sea water salinity");
......
......@@ -1769,12 +1769,11 @@ void after_postcntl(struct Control *globs, struct Variable *vars)
vlistInqVarUnits(globs->ivlistID, ivarID, units);
}
int tsteptype = (globs->Mean) ? TSTEP_AVG : TSTEP_INSTANT;
if ( globs->Mean != 2 )
{
vlistDefTaxis(globs->ovlistID, globs->taxisID2);
ovarID = vlistDefVar(globs->ovlistID, ogridID, ozaxisID, tsteptype);
ovarID = vlistDefVar(globs->ovlistID, ogridID, ozaxisID, TIME_VARYING);
if ( globs->Mean ) vlistDefVarTsteptype(globs->ovlistID, ovarID, TSTEP_AVG);
vlistDefVarCode(globs->ovlistID, ovarID, code);
vars[code].ovarID = ovarID;
vlistDefVarInstitut(globs->ovlistID, ovarID, instID);
......@@ -1790,7 +1789,8 @@ void after_postcntl(struct Control *globs, struct Variable *vars)
if ( globs->Mean >= 2 )
{
vlistDefTaxis(globs->ovlistID2, globs->taxisID2);
ovarID2 = vlistDefVar(globs->ovlistID2, ogridID, ozaxisID, tsteptype);
ovarID2 = vlistDefVar(globs->ovlistID2, ogridID, ozaxisID, TIME_VARYING);
if ( globs->Mean ) vlistDefVarTsteptype(globs->ovlistID2, ovarID2, TSTEP_AVG);
vlistDefVarCode(globs->ovlistID2, ovarID2, code);
vars[code].ovarID2 = ovarID2;
vlistDefVarInstitut(globs->ovlistID2, ovarID2, instID);
......
......@@ -199,7 +199,7 @@ void *CDIwrite(void *argument)
for ( i = 0; i < nvars; ++i )
{
varID = vlistDefVar(vlistID, gridID, zaxisID, TSTEP_INSTANT);
varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING);
vlistDefVarParam(vlistID, varID, cdiEncodeParam(varID+1, 255, 255));
// vlistDefVarName(vlistID, varID, );
}
......
......@@ -925,7 +925,7 @@ static void addcharvar(keyValues_t *charvars, int vlistID, const char *key, stru
zaxisDefLevels(subzaxisID, zvals);
struct mapping *var = new_var_mapping(vars);
var->cdi_varID = vlistDefVar(vlistID, subgridID, subzaxisID, TSTEP_INSTANT);
var->cdi_varID = vlistDefVar(vlistID, subgridID, subzaxisID, TIME_VARYING);
vlistDefVarName(vlistID, getVarIDToMap(vlistID, nvars+1, key, charvars->values[0]), "ChangedForMap");
vlistDefVarName(vlistID, var->cdi_varID, charvars->values[0]);
vlistDefVarDatatype(vlistID, var->cdi_varID, DATATYPE_FLT64);
......
......@@ -67,7 +67,7 @@ void *Cat(void *argument)
if ( ntsteps == 1 )
{
for ( varID = 0; varID < nvars; ++varID )
if ( vlistInqVarTsteptype(vlistID1, varID) != TSTEP_CONSTANT ) break;
if ( vlistInqVarTimetype(vlistID1, varID) != TIME_CONSTANT ) break;
if ( varID == nvars ) ntsteps = 0;
}
......@@ -102,7 +102,7 @@ void *Cat(void *argument)
{
lconstvars = false;
for ( varID = 0; varID < nvars; ++varID )
vlistDefVarTsteptype(vlistID2, varID, TSTEP_INSTANT);
vlistDefVarTimetype(vlistID2, varID, TIME_VARYING);
}
pstreamDefVlist(streamID2, vlistID2);
......@@ -136,7 +136,7 @@ void *Cat(void *argument)
pstreamInqRecord(streamID1, &varID, &levelID);
if ( lconstvars && tsID2 > 0 && tsID1 == 0 )
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT )
if ( vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT )
continue;
pstreamDefRecord(streamID2, varID, levelID);
......
......@@ -276,7 +276,7 @@ void *Cloudlayer(void *argument)
if ( nvars2 == 1 )
{
varID = vlistDefVar(vlistID2, gridID, surfaceID, TSTEP_INSTANT);
varID = vlistDefVar(vlistID2, gridID, surfaceID, TIME_VARYING);
vlistDefVarParam(vlistID2, varID, cdiEncodeParam(33, 128, 255));
vlistDefVarName(vlistID2, varID, "cld_lay");
vlistDefVarLongname(vlistID2, varID, "cloud layer");
......@@ -284,19 +284,19 @@ void *Cloudlayer(void *argument)
}
else
{
varID = vlistDefVar(vlistID2, gridID, surfaceID, TSTEP_INSTANT);
varID = vlistDefVar(vlistID2, gridID, surfaceID, TIME_VARYING);
vlistDefVarParam(vlistID2, varID, cdiEncodeParam(34, 128, 255));
vlistDefVarName(vlistID2, varID, "low_cld");
vlistDefVarLongname(vlistID2, varID, "low cloud");
vlistDefVarMissval(vlistID2, varID, missval);
varID = vlistDefVar(vlistID2, gridID, surfaceID, TSTEP_INSTANT);
varID = vlistDefVar(vlistID2, gridID, surfaceID, TIME_VARYING);
vlistDefVarParam(vlistID2, varID, cdiEncodeParam(35, 128, 255));
vlistDefVarName(vlistID2, varID, "mid_cld");
vlistDefVarLongname(vlistID2, varID, "mid cloud");
vlistDefVarMissval(vlistID2, varID, missval);
varID = vlistDefVar(vlistID2, gridID, surfaceID, TSTEP_INSTANT);
varID = vlistDefVar(vlistID2, gridID, surfaceID, TIME_VARYING);
vlistDefVarParam(vlistID2, varID, cdiEncodeParam(36, 128, 255));
vlistDefVarName(vlistID2, varID, "hih_cld");
vlistDefVarLongname(vlistID2, varID, "high cloud");
......
......@@ -102,7 +102,7 @@ void *Copy(void *argument)
if ( ntsteps == 1 )
{
for ( varID = 0; varID < nvars; ++varID )
if ( vlistInqVarTsteptype(vlistID1, varID) != TSTEP_CONSTANT ) break;
if ( vlistInqVarTimetype(vlistID1, varID) != TIME_CONSTANT ) break;
if ( varID == nvars ) ntsteps = 0;
}
......@@ -111,7 +111,7 @@ void *Copy(void *argument)
{
lconstvars = false;
for ( varID = 0; varID < nvars; ++varID )
vlistDefVarTsteptype(vlistID2, varID, TSTEP_INSTANT);
vlistDefVarTimetype(vlistID2, varID, TIME_VARYING);
}
pstreamDefVlist(streamID2, vlistID2);
......@@ -144,7 +144,7 @@ void *Copy(void *argument)
pstreamInqRecord(streamID1, &varID, &levelID);
if ( lconstvars && tsID2 > 0 && tsID1 == 0 )
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT )
if ( vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT )
continue;
pstreamDefRecord(streamID2, varID, levelID);
......@@ -164,7 +164,7 @@ void *Copy(void *argument)
pstreamInqRecord(streamID1, &varID, &levelID);
if ( lconstvars && tsID2 > 0 && tsID1 == 0 )
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT )
if ( vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT )
continue;
pstreamReadRecord(streamID1, array, &nmiss);
......
......@@ -271,12 +271,12 @@ void *Derivepar(void *argument)
if ( operatorID == GHEIGHT )
{
var_id = geopotential_height;
varID = vlistDefVar(vlistID2, gridID, zaxisIDh, TSTEP_INSTANT);
varID = vlistDefVar(vlistID2, gridID, zaxisIDh, TIME_VARYING);
}
else if ( operatorID == SEALEVELPRESSURE )
{
var_id = air_pressure_at_sea_level;
varID = vlistDefVar(vlistID2, gridID, surfaceID, TSTEP_INSTANT);
varID = vlistDefVar(vlistID2, gridID, surfaceID, TIME_VARYING);
}
else
cdoAbort("Internal problem, invalid operatorID: %d!", operatorID);
......
......@@ -56,7 +56,7 @@ void *Duplicate(void *argument)
if ( ntsteps == 1 )
{
for ( varID = 0; varID < nvars; ++varID )
if ( vlistInqVarTsteptype(vlistID1, varID) != TSTEP_CONSTANT ) break;
if ( vlistInqVarTimetype(vlistID1, varID) != TIME_CONSTANT ) break;
if ( varID == nvars ) ntsteps = 0;
}
......@@ -64,7 +64,7 @@ void *Duplicate(void *argument)
if ( ntsteps == 0 )
{
for ( varID = 0; varID < nvars; ++varID )
vlistDefVarTsteptype(vlistID2, varID, TSTEP_INSTANT);
vlistDefVarTimetype(vlistID2, varID, TIME_VARYING);
}
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
......
......@@ -1475,7 +1475,7 @@ void *Echam5ini(void *argument)
{/*
fprintf(stderr, "%d %s %d %d %d %d\n", iv, vars[iv].name, vars[iv].gridID, vars[iv].zaxisID, gridInqSize(vars[iv].gridID), zaxisInqSize(vars[iv].zaxisID));
*/
varID = vlistDefVar(vlistID2, vars[iv].gridID, vars[iv].zaxisID, TSTEP_CONSTANT);
varID = vlistDefVar(vlistID2, vars[iv].gridID, vars[iv].zaxisID, TIME_CONSTANT);
if ( vars[iv].code > 0 ) vlistDefVarCode(vlistID2, varID, vars[iv].code);
if ( vars[iv].name ) vlistDefVarName(vlistID2, varID, vars[iv].name);
if ( vars[iv].longname ) vlistDefVarLongname(vlistID2, varID, vars[iv].longname);
......
......@@ -236,8 +236,8 @@ void *Ensstat(void *argument)
strcat(name, "_count");
int gridID = vlistInqVarGrid(vlistID2, varID);
int zaxisID = vlistInqVarZaxis(vlistID2, varID);
int tsteptype = vlistInqVarTsteptype(vlistID2, varID);
int cvarID = vlistDefVar(vlistID2, gridID, zaxisID, tsteptype);
int timetype = vlistInqVarTimetype(vlistID2, varID);
int cvarID = vlistDefVar(vlistID2, gridID, zaxisID, timetype);
vlistDefVarName(vlistID2, cvarID, name);
vlistDefVarDatatype(vlistID2, cvarID, CDI_DATATYPE_INT16);
if ( cvarID != (varID+nvars) ) cdoAbort("Internal error, varIDs do not match!");
......
......@@ -149,7 +149,7 @@ void *Ensstat3(void *argument)
zaxisDefLevels(zaxisID2,levs);
zaxisDefName(zaxisID2, "histogram_binID");
int time_mode = datafunc == TIME? TSTEP_INSTANT : TSTEP_CONSTANT;
int time_mode = datafunc == TIME? TIME_VARYING : TIME_CONSTANT;
for ( varID=0; varID<nvars; varID++) {
......
......@@ -132,8 +132,8 @@ void *Eofcoeff(void * argument)
vlistChangeGridIndex(vlistID3, i, gridID3);
vlistDefTaxis(vlistID3, taxisID3);
for (varID =0; varID<nvars; varID++)
vlistDefVarTsteptype(vlistID3, varID, TSTEP_INSTANT);
for (varID = 0; varID<nvars; varID++)
vlistDefVarTimetype(vlistID3, varID, TIME_VARYING);
// open streams for eofcoeff output
int *streamIDs = (int*) Malloc(neof*sizeof(int));
......
......@@ -143,7 +143,7 @@ void *Eofcoeff3d(void * argument)
vlistDefTaxis(vlistID3,taxisID3);
for (varID =0; varID<nvars; varID++)
vlistDefVarTsteptype(vlistID3, varID, TSTEP_INSTANT);
vlistDefVarTimetype(vlistID3, varID, TIME_VARYING);
// open streams for eofcoeff output
int *streamIDs = (int*) Malloc(neof*sizeof(int));
......
......@@ -104,7 +104,7 @@ paramType *params_new(int vlistID)
{
int gridID = vlistInqVarGrid(vlistID, varID);
int zaxisID = vlistInqVarZaxis(vlistID, varID);
int steptype = vlistInqVarTsteptype(vlistID, varID);
int steptype = vlistInqVarTimetype(vlistID, varID);
int ngp = gridInqSize(gridID);
int nlev = zaxisInqSize(zaxisID);
double missval = vlistInqVarMissval(vlistID, varID);
......@@ -214,7 +214,7 @@ int params_add_ts(parse_param_t *parse_arg)
params[varID].name = strdup("_ts");
params[varID].gridID = parse_arg->pointID;
params[varID].zaxisID = parse_arg->surfaceID;
params[varID].steptype = TSTEP_INSTANT;
params[varID].steptype = TIME_VARYING;
params[varID].ngp = 1;
params[varID].nlev = 1;
......@@ -505,7 +505,7 @@ void *Expr(void *argument)
pstreamDefTimestep(streamID2, tsID);
for ( int varID = 0; varID < nvars1; varID++ )
if ( tsID == 0 || params[varID].steptype != TSTEP_CONSTANT )
if ( tsID == 0 || params[varID].steptype != TIME_CONSTANT )
params[varID].nmiss = 0;
for ( int recID = 0; recID < nrecs; recID++ )
......@@ -540,7 +540,7 @@ void *Expr(void *argument)
{
int pidx = varIDmap[varID];
if ( tsID > 0 && params[pidx].steptype == TSTEP_CONSTANT ) continue;
if ( tsID > 0 && params[pidx].steptype == TIME_CONSTANT ) continue;
double missval = vlistInqVarMissval(vlistID2, varID);
......
......@@ -117,7 +117,7 @@ void *Gengrid(void *argument)
int zaxisID3 = zaxisCreate(ZAXIS_SURFACE, 1);
int vlistID3 = vlistCreate();
vlistDefVar(vlistID3, gridID3, zaxisID3, TSTEP_CONSTANT);
vlistDefVar(vlistID3, gridID3, zaxisID3, TIME_CONSTANT);
vlistDefVarMissval(vlistID3, 0, missval);
vlistDefVarName(vlistID3, 0, "dummy");
vlistDefVarDatatype(vlistID3, 0, CDI_DATATYPE_INT8);
......
......@@ -737,7 +737,7 @@ void ctl_vars(FILE *gdp, int filetype, int vlistID, int nvarsout, int *vars)
int xyz = vlistInqVarXYZ(vlistID, varID);
fprintf(gdp, " ");
if ( vlistInqVarTsteptype(vlistID, varID) != TSTEP_CONSTANT )
if ( vlistInqVarTimetype(vlistID, varID) != TIME_CONSTANT )
fprintf(gdp, "t,");
if ( xyz == 321 )
{
......@@ -1083,7 +1083,7 @@ void *Gradsdes(void *argument)
recoffset[varID] = nrecsout;
nvarsout++;
nrecsout += zaxisInqSize(vlistInqVarZaxis(vlistID, varID));
if ( ntsteps != 1 && ntsteps != 0 && vlistInqVarTsteptype(vlistID, varID) == TSTEP_CONSTANT )
if ( ntsteps != 1 && ntsteps != 0 && vlistInqVarTimetype(vlistID, varID) == TIME_CONSTANT )
cdoAbort("Unsupported GrADS record structure! Variable %d has only 1 time step.",
vlistInqVarCode(vlistID, varID));
}
......
......@@ -125,7 +125,7 @@ void *Gridcell(void *argument)
int zaxisID = zaxisCreate(ZAXIS_SURFACE, 1);
int vlistID2 = vlistCreate();
int varID = vlistDefVar(vlistID2, gridID, zaxisID, TSTEP_CONSTANT);
int varID = vlistDefVar(vlistID2, gridID, zaxisID, TIME_CONSTANT);
vlistDefNtsteps(vlistID2, 0);
if ( operatorID == GRIDAREA )
......
......@@ -128,7 +128,7 @@ void *Hi(void *argument)
int vlistID4 = vlistCreate();
int gridID = vlistInqVarGrid(vlistID1, FIRST_VAR);
int zaxisID = vlistInqVarZaxis(vlistID1, FIRST_VAR);
int varID4 = vlistDefVar(vlistID4, gridID, zaxisID, TSTEP_INSTANT);
int varID4 = vlistDefVar(vlistID4, gridID, zaxisID, TIME_VARYING);
int taxisID4 = taxisCreate(TAXIS_RELATIVE);
taxisDefTunit(taxisID4, TUNIT_MINUTE);
......
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