Commit 9b5fe24a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

ntsteps cleanup

parent a32730ca
......@@ -84,10 +84,12 @@ void *Arith(void *argument)
ntsteps1 = vlistNtsteps(vlistID1);
ntsteps2 = vlistNtsteps(vlistID2);
if ( ntsteps1 == 0 ) ntsteps1 = 1;
if ( ntsteps2 == 0 ) ntsteps2 = 1;
if ( vlistNrecs(vlistID1) != 1 && vlistNrecs(vlistID2) == 1 )
{
if ( ntsteps1 != 1 && ntsteps1 != 0 && (ntsteps2 == 1 || ntsteps2 == 0) )
if ( ntsteps1 != 1 && ntsteps2 == 1 )
{
filltype = FILL_REC;
cdoPrint("Filling up stream2 >%s< by copying the first record.", cdoStreamName(1));
......@@ -100,7 +102,7 @@ void *Arith(void *argument)
}
else if ( vlistNrecs(vlistID1) == 1 && vlistNrecs(vlistID2) != 1 )
{
if ( (ntsteps1 == 1 || ntsteps1 == 0) && ntsteps2 != 1 && ntsteps2 != 0 )
if ( ntsteps1 == 1 && ntsteps2 != 1 )
{
filltype = FILL_REC;
cdoPrint("Filling up stream1 >%s< by copying the first record.", cdoStreamName(0));
......@@ -136,12 +138,12 @@ void *Arith(void *argument)
if ( filltype == FILL_NONE )
{
if ( ntsteps1 != 1 && ntsteps1 != 0 && (ntsteps2 == 1 || ntsteps2 == 0) )
if ( ntsteps1 != 1 && ntsteps2 == 1 )
{
filltype = FILL_TS;
cdoPrint("Filling up stream2 >%s< by copying the first timestep.", cdoStreamName(1));
}
else if ( (ntsteps1 == 1 || ntsteps1 == 0) && ntsteps2 != 1 && ntsteps2 != 0 )
else if ( ntsteps1 == 1 && ntsteps2 != 1 )
{
filltype = FILL_TS;
cdoPrint("Filling up stream1 >%s< by copying the first timestep.", cdoStreamName(0));
......
......@@ -44,6 +44,7 @@ void *Comp(void *argument)
int tsID;
int varID, levelID;
int offset;
int ntsteps1, ntsteps2;
int vlistIDx1, vlistIDx2, vlistID1, vlistID2, vlistID3;
int taxisIDx1, taxisID1, taxisID2, taxisID3;
int nmiss1, nmiss2, nmiss3;
......@@ -82,6 +83,11 @@ void *Comp(void *argument)
taxisID2 = vlistInqTaxis(vlistID2);
taxisIDx1 = taxisID1;
ntsteps1 = vlistNtsteps(vlistID1);
ntsteps2 = vlistNtsteps(vlistID2);
if ( ntsteps1 == 0 ) ntsteps1 = 1;
if ( ntsteps2 == 0 ) ntsteps2 = 1;
if ( vlistNrecs(vlistID1) != 1 && vlistNrecs(vlistID2) == 1 )
{
filltype = FILL_REC;
......@@ -114,19 +120,16 @@ void *Comp(void *argument)
arrayx2 = array2;
if ( cdoVerbose )
cdoPrint("Number of timesteps: file1 %d, file2 %d",
vlistNtsteps(vlistID1), vlistNtsteps(vlistID2));
cdoPrint("Number of timesteps: file1 %d, file2 %d", ntsteps1, ntsteps2);
if ( filltype == FILL_NONE )
{
if ( vlistNtsteps(vlistID1) != 1 && vlistNtsteps(vlistID1) != 0 &&
(vlistNtsteps(vlistID2) == 1 || vlistNtsteps(vlistID2) == 0) )
if ( ntsteps1 != 1 && ntsteps2 == 1 )
{
filltype = FILL_TS;
cdoPrint("Filling up stream2 >%s< by copying the first timestep.", cdoStreamName(1));
}
else if ( (vlistNtsteps(vlistID1) == 1 || vlistNtsteps(vlistID1) == 0) &&
vlistNtsteps(vlistID2) != 1 && vlistNtsteps(vlistID2) != 0 )
else if ( ntsteps1 == 1 && ntsteps2 != 1 )
{
filltype = FILL_TS;
cdoPrint("Filling up stream1 >%s< by copying the first timestep.", cdoStreamName(0));
......@@ -150,7 +153,7 @@ void *Comp(void *argument)
}
}
if ( filltype != FILL_NONE && vlistNtsteps(vlistID1) == 1 )
if ( filltype != FILL_NONE && ntsteps1 == 1 )
{
arrayx1 = array2;
arrayx2 = array1;
......
......@@ -36,6 +36,7 @@ void *Cond(void *argument)
int filltype = FILL_NONE;
int streamID1, streamID2, streamID3;
int gridsize;
int ntsteps1, ntsteps2;
int nrecs, nrecs2, nvars = 0, nlev, recID;
int tsID;
int varID, levelID;
......@@ -68,6 +69,11 @@ void *Cond(void *argument)
taxisID3 = taxisDuplicate(taxisID2);
vlistDefTaxis(vlistID3, taxisID3);
ntsteps1 = vlistNtsteps(vlistID1);
ntsteps2 = vlistNtsteps(vlistID2);
if ( ntsteps1 == 0 ) ntsteps1 = 1;
if ( ntsteps2 == 0 ) ntsteps2 = 1;
if ( vlistNrecs(vlistID1) == 1 && vlistNrecs(vlistID2) != 1 )
{
filltype = FILL_REC;
......@@ -94,12 +100,11 @@ void *Cond(void *argument)
array3 = (double *) malloc(gridsize*sizeof(double));
if ( cdoVerbose )
cdoPrint("Number of timesteps: file1 %d, file2 %d", vlistNtsteps(vlistID1), vlistNtsteps(vlistID2));
cdoPrint("Number of timesteps: file1 %d, file2 %d", ntsteps1, ntsteps2);
if ( filltype == FILL_NONE )
{
if ( (vlistNtsteps(vlistID1) == 1 || vlistNtsteps(vlistID1) == 0) &&
vlistNtsteps(vlistID2) != 1 && vlistNtsteps(vlistID2) != 0 )
if ( ntsteps1 == 1 || ntsteps2 != 1 )
{
filltype = FILL_TS;
cdoPrint("Filling up stream1 >%s< by copying the first timestep.", cdoStreamName(0));
......
......@@ -39,6 +39,7 @@ void *Cond2(void *argument)
int tsID;
int varID, levelID;
int offset;
int ntsteps1, ntsteps2;
int vlistID1, vlistID2, vlistID3, vlistID4;
int nmiss1, nmiss2, nmiss3, nmiss4;
int i;
......@@ -68,6 +69,11 @@ void *Cond2(void *argument)
taxisID4 = taxisDuplicate(taxisID2);
vlistDefTaxis(vlistID4, taxisID4);
ntsteps1 = vlistNtsteps(vlistID1);
ntsteps2 = vlistNtsteps(vlistID2);
if ( ntsteps1 == 0 ) ntsteps1 = 1;
if ( ntsteps2 == 0 ) ntsteps2 = 1;
if ( vlistNrecs(vlistID1) == 1 && vlistNrecs(vlistID2) != 1 )
{
filltype = FILL_REC;
......@@ -99,12 +105,11 @@ void *Cond2(void *argument)
if ( cdoVerbose )
cdoPrint("Number of timesteps: file1 %d, file2 %d, file3 %d",
vlistNtsteps(vlistID1), vlistNtsteps(vlistID2), vlistNtsteps(vlistID3));
ntsteps1, ntsteps2, vlistNtsteps(vlistID3));
if ( filltype == FILL_NONE )
{
if ( (vlistNtsteps(vlistID1) == 1 || vlistNtsteps(vlistID1) == 0) &&
vlistNtsteps(vlistID2) != 1 && vlistNtsteps(vlistID2) != 0 )
if ( ntsteps1 == 1 || ntsteps2 != 1 )
{
filltype = FILL_TS;
cdoPrint("Filling up stream1 >%s< by copying the first timestep.", cdoStreamName(0));
......
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