Commit 957aa46a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

ydaypctl: check of verification date failed (bug fix)

parent 2b00009a
......@@ -3,6 +3,10 @@
* using CDI library version 1.7.1
* Version 1.7.1 released
2016-01-08 Uwe Schulzweida
* ydaypctl: check of verification date failed (bug fix)
2016-01-07 Uwe Schulzweida
* setpartab: added support to combine setpartab operators (bug fix) [report: Karl-Hermann Wieners]
......
......@@ -34,26 +34,19 @@ int getmonthday(int date);
void *Ydaypctl(void *argument)
{
int gridsize;
int varID;
int recID;
int gridID;
int vdate, vtime;
int year, month, day, dayoy;
int nrecs, nrecords;
int nrecs;
int levelID;
int tsID;
int otsID;
long nsets[NDAY];
int streamID1, streamID2, streamID3, streamID4;
int vlistID1, vlistID2, vlistID3, vlistID4, taxisID1, taxisID2, taxisID3, taxisID4;
int nmiss;
int nvars, nlevels;
int *recVarID, *recLevelID;
int nlevels;
int vdates1[NDAY], vtimes1[NDAY];
int vdates2[NDAY], vtimes2[NDAY];
int vdates2[NDAY];
long nsets[NDAY];
field_t **vars1[NDAY];
field_t field;
HISTOGRAM_SET *hsets[NDAY];
cdoInitialize(argument);
......@@ -70,42 +63,44 @@ void *Ydaypctl(void *argument)
nsets[dayoy] = 0;
}
streamID1 = streamOpenRead(cdoStreamName(0));
streamID2 = streamOpenRead(cdoStreamName(1));
streamID3 = streamOpenRead(cdoStreamName(2));
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID2 = streamOpenRead(cdoStreamName(1));
int streamID3 = streamOpenRead(cdoStreamName(2));
vlistID1 = streamInqVlist(streamID1);
vlistID2 = streamInqVlist(streamID2);
vlistID3 = streamInqVlist(streamID3);
vlistID4 = vlistDuplicate(vlistID1);
int vlistID1 = streamInqVlist(streamID1);
int vlistID2 = streamInqVlist(streamID2);
int vlistID3 = streamInqVlist(streamID3);
int vlistID4 = vlistDuplicate(vlistID1);
vlistCompare(vlistID1, vlistID2, CMP_ALL);
vlistCompare(vlistID1, vlistID3, CMP_ALL);
taxisID1 = vlistInqTaxis(vlistID1);
taxisID2 = vlistInqTaxis(vlistID2);
taxisID3 = vlistInqTaxis(vlistID3);
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = vlistInqTaxis(vlistID2);
int taxisID3 = vlistInqTaxis(vlistID3);
/* TODO - check that time axes 2 and 3 are equal */
taxisID4 = taxisDuplicate(taxisID1);
int taxisID4 = taxisDuplicate(taxisID1);
if ( taxisHasBounds(taxisID4) ) taxisDeleteBounds(taxisID4);
vlistDefTaxis(vlistID4, taxisID4);
streamID4 = streamOpenWrite(cdoStreamName(3), cdoFiletype());
int streamID4 = streamOpenWrite(cdoStreamName(3), cdoFiletype());
streamDefVlist(streamID4, vlistID4);
nvars = vlistNvars(vlistID1);
nrecords = vlistNrecs(vlistID1);
int nvars = vlistNvars(vlistID1);
int nrecords = vlistNrecs(vlistID1);
recVarID = (int*) Malloc(nrecords*sizeof(int));
recLevelID = (int*) Malloc(nrecords*sizeof(int));
int *recVarID = (int*) Malloc(nrecords*sizeof(int));
int *recLevelID = (int*) Malloc(nrecords*sizeof(int));
gridsize = vlistGridsizeMax(vlistID1);
int gridsize = vlistGridsizeMax(vlistID1);
field_t field;
field_init(&field);
field.ptr = (double*) Malloc(gridsize*sizeof(double));
tsID = 0;
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID2, tsID)) )
{
if ( nrecs != streamInqTimestep(streamID3, tsID) )
......@@ -114,7 +109,7 @@ void *Ydaypctl(void *argument)
vdate = taxisInqVdate(taxisID2);
vtime = taxisInqVtime(taxisID2);
if ( vdate != taxisInqVdate(taxisID3) || vtime != taxisInqVtime(taxisID3) )
if ( vdate != taxisInqVdate(taxisID3) )
cdoAbort("Verification dates at time step %d of %s and %s differ!", tsID+1, cdoStreamName(1)->args, cdoStreamName(2)->args);
if ( cdoVerbose ) cdoPrint("process timestep: %d %d %d", tsID+1, vdate, vtime);
......@@ -130,7 +125,6 @@ void *Ydaypctl(void *argument)
cdoAbort("Day %d out of range!", dayoy);
vdates2[dayoy] = vdate;
vtimes2[dayoy] = vtime;
if ( vars1[dayoy] == NULL )
{
......@@ -210,13 +204,13 @@ void *Ydaypctl(void *argument)
tsID++;
}
otsID = 0;
int otsID = 0;
for ( dayoy = 0; dayoy < NDAY; dayoy++ )
if ( nsets[dayoy] )
{
if ( vdates1[dayoy] != vdates2[dayoy] )
cdoAbort("Verification dates for day %d of %s, %s and %s are different!",
dayoy, cdoStreamName(0)->args, cdoStreamName(1)->args, cdoStreamName(2)->args);
if ( getmonthday(vdates1[dayoy]) != getmonthday(vdates2[dayoy]) )
cdoAbort("Verification dates for the day %d of %s and %s are different!",
dayoy, cdoStreamName(0)->args, cdoStreamName(1)->args);
for ( varID = 0; varID < nvars; varID++ )
{
......
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