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

duplicate: check time constant vars

parent 1fbf87e3
......@@ -36,6 +36,7 @@ void *Duplicate(void *argument)
int vlistID1, vlistID2, taxisID1, taxisID2;
int nmiss;
int nvars, nlevel;
int ntsteps;
int *vdate = NULL, *vtime = NULL;
int idup, ndup = 1;
double missval;
......@@ -58,6 +59,23 @@ void *Duplicate(void *argument)
taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
ntsteps = vlistNtsteps(vlistID1);
nvars = vlistNvars(vlistID1);
if ( ntsteps == 1 )
{
for ( varID = 0; varID < nvars; ++varID )
if ( vlistInqVarTime(vlistID1, varID) == TIME_VARIABLE ) break;
if ( varID == nvars ) ntsteps = 0;
}
if ( ntsteps == 0 )
{
for ( varID = 0; varID < nvars; ++varID )
vlistDefVarTime(vlistID2, varID, TIME_VARIABLE);
}
streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
if ( streamID2 < 0 ) cdiError(streamID2, "Open failed on %s", cdoStreamName(1));
......
......@@ -222,7 +222,7 @@ void *Settime(void *argument)
taxisID1 = vlistInqTaxis(vlistID1);
taxis_has_bounds = taxisHasBounds(taxisID1);
ntsteps = vlistNtsteps(vlistID1);
nvars = vlistNvars(vlistID1);
nvars = vlistNvars(vlistID1);
if ( ntsteps == 1 )
{
......
Supports Markdown
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