Commit 0cd6ec59 authored by Uwe Schulzweida's avatar Uwe Schulzweida

Changed while statement for cdoStreamInqTimestep().

parent eb8f3173
Pipeline #5699 passed with stages
in 15 minutes and 2 seconds
...@@ -144,7 +144,7 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in ...@@ -144,7 +144,7 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in
if (cdoAssertFilesOnly() == false) if (cdoAssertFilesOnly() == false)
cdoAbort("infile1 cannot be a pipe"); cdoAbort("infile1 cannot be a pipe");
const auto maxrecs = vlistNrecs(vlistID1); const auto maxrecs = vlistNrecs(vlistID1);
CdiStreamID cdiStream = streamOpenRead(cdoGetStreamName(0)); auto cdiStream = streamOpenRead(cdoGetStreamName(0));
const auto cdiVlistID = streamInqVlist(cdiStream); const auto cdiVlistID = streamInqVlist(cdiStream);
const auto cdiTaxisID = vlistInqTaxis(cdiVlistID); const auto cdiTaxisID = vlistInqTaxis(cdiVlistID);
...@@ -152,14 +152,17 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in ...@@ -152,14 +152,17 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in
int tempdpy = 0; int tempdpy = 0;
for ( int i = 0; i<MaxMonths; i++) for ( int i = 0; i<MaxMonths; i++)
tempdpm[i] = 0; tempdpm[i] = 0;
int year, month, day, tsID = 0, nrecs = 0, varID, levelID; int year, month, day, tsID = 0, varID, levelID;
bool lHasStarted = false; bool lHasStarted = false;
if (Options::cdoVerbose) cdoPrint("Start to process variables"); if (Options::cdoVerbose) cdoPrint("Start to process variables");
while ( ( nrecs = streamInqTimestep(cdiStream, tsID++) ) ) while (true)
{ {
int64_t vdate = taxisInqVdate(cdiTaxisID); const auto nrecs = streamInqTimestep(cdiStream, tsID++);
if (nrecs == 0) break;
auto vdate = taxisInqVdate(cdiTaxisID);
cdiDecodeDate(vdate, &year, &month, &day); cdiDecodeDate(vdate, &year, &month, &day);
if ( !lHasStarted && year != recentYear ) if ( !lHasStarted && year != recentYear )
continue; continue;
...@@ -180,14 +183,13 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in ...@@ -180,14 +183,13 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in
fieldFill(cei[loopmonth][0][0], 0.); fieldFill(cei[loopmonth][0][0], 0.);
} }
} }
if ( year == endOfCalc && func2 == func_avg ) if (year == endOfCalc && func2 == func_avg) break;
break;
tempdpy++; tempdpy++;
int dayoy = (month >= 1 && month <= 12) ? (month - 1) * 31 + day : 0; int dayoy = (month >= 1 && month <= 12) ? (month - 1) * 31 + day : 0;
tempdpm[month-1]++; tempdpm[month-1]++;
if ( func2 == func_sum ) if ( func2 == func_sum ) dayoy = 1;
dayoy = 1;
for (int recID = 0; recID < nrecs; recID++) for (int recID = 0; recID < nrecs; recID++)
{ {
streamInqRecord(cdiStream, &varID, &levelID); streamInqRecord(cdiStream, &varID, &levelID);
...@@ -217,7 +219,7 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in ...@@ -217,7 +219,7 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in
fieldFill(cei[0][0][0], 0.); fieldFill(cei[0][0][0], 0.);
if ( frequency == 8 ) if ( frequency == 8 )
for ( int loopmonth = 1; loopmonth < MaxMonths; loopmonth++) for (int loopmonth = 1; loopmonth < MaxMonths; loopmonth++)
{ {
tempdpm[loopmonth] = 0; tempdpm[loopmonth] = 0;
fieldFill(cei[loopmonth][0][0], 0.); fieldFill(cei[loopmonth][0][0], 0.);
...@@ -232,7 +234,6 @@ etccdi_op(ETCCDI_REQUEST *request) ...@@ -232,7 +234,6 @@ etccdi_op(ETCCDI_REQUEST *request)
constexpr int MaxDays = 373; constexpr int MaxDays = 373;
constexpr int MaxMonths = 12; constexpr int MaxMonths = 12;
int varID; int varID;
int nrecs;
int levelID; int levelID;
size_t nmiss; size_t nmiss;
int year, month, day, dayoy; int year, month, day, dayoy;
...@@ -336,8 +337,11 @@ etccdi_op(ETCCDI_REQUEST *request) ...@@ -336,8 +337,11 @@ etccdi_op(ETCCDI_REQUEST *request)
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID2, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID2, tsID);
if (nrecs == 0) break;
if (nrecs != cdoStreamInqTimestep(streamID3, tsID)) if (nrecs != cdoStreamInqTimestep(streamID3, tsID))
cdoAbort("Number of records at time step %d of %s and %s differ!", tsID + 1, cdoGetStreamName(1), cdoAbort("Number of records at time step %d of %s and %s differ!", tsID + 1, cdoGetStreamName(1),
cdoGetStreamName(2)); cdoGetStreamName(2));
...@@ -415,8 +419,11 @@ etccdi_op(ETCCDI_REQUEST *request) ...@@ -415,8 +419,11 @@ etccdi_op(ETCCDI_REQUEST *request)
tsID = 0; tsID = 0;
bool lOnlyRefPeriod = true; bool lOnlyRefPeriod = true;
int firstYear = 0, lastYear = 0; int firstYear = 0, lastYear = 0;
while ( (nrecs = cdoStreamInqTimestep(streamID1, tsID++) ) ) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID++);
if (nrecs == 0) break;
vdate = taxisInqVdate(taxisID1); vdate = taxisInqVdate(taxisID1);
vtime = taxisInqVtime(taxisID1); vtime = taxisInqVtime(taxisID1);
...@@ -435,7 +442,7 @@ etccdi_op(ETCCDI_REQUEST *request) ...@@ -435,7 +442,7 @@ etccdi_op(ETCCDI_REQUEST *request)
if (dayoy < 0 || dayoy >= MaxDays) cdoAbort("Day %d out of range!", dayoy); if (dayoy < 0 || dayoy >= MaxDays) cdoAbort("Day %d out of range!", dayoy);
if (wdaysSrc[dayoy] || request->func2 == func_sum ) if (wdaysSrc[dayoy] || request->func2 == func_sum )
{ {
/* Variable independent ? */ /* Variable independent ? */
wdaysRead[dayoy+(year-request->startboot)*(MaxDays-1)] = dayoy+(year-request->startboot)*(MaxDays-1); wdaysRead[dayoy+(year-request->startboot)*(MaxDays-1)] = dayoy+(year-request->startboot)*(MaxDays-1);
dpy[year-request->startboot]++; dpy[year-request->startboot]++;
dpm[(year-request->startboot)*MaxMonths+(int)((dayoy-1)/31.)]++; dpm[(year-request->startboot)*MaxMonths+(int)((dayoy-1)/31.)]++;
......
...@@ -35,7 +35,6 @@ void * ...@@ -35,7 +35,6 @@ void *
Ydayarith(void *process) Ydayarith(void *process)
{ {
constexpr int MaxDays = 373; constexpr int MaxDays = 373;
int nrecs;
int varID, levelID; int varID, levelID;
cdoInitialize(process); cdoInitialize(process);
...@@ -78,8 +77,11 @@ Ydayarith(void *process) ...@@ -78,8 +77,11 @@ Ydayarith(void *process)
FieldVector2D vars2[MaxDays]; FieldVector2D vars2[MaxDays];
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID2, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID2, tsID);
if (nrecs == 0) break;
const auto vdate = taxisInqVdate(taxisID2); const auto vdate = taxisInqVdate(taxisID2);
const auto dayoy = decodeDayOfYear(vdate); const auto dayoy = decodeDayOfYear(vdate);
if (dayoy < 0 || dayoy >= MaxDays) cdoAbort("Day of year %d out of range (date=%d)!", dayoy, vdate); if (dayoy < 0 || dayoy >= MaxDays) cdoAbort("Day of year %d out of range (date=%d)!", dayoy, vdate);
...@@ -99,8 +101,11 @@ Ydayarith(void *process) ...@@ -99,8 +101,11 @@ Ydayarith(void *process)
} }
tsID = 0; tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
const auto vdate = taxisInqVdate(taxisID1); const auto vdate = taxisInqVdate(taxisID1);
const auto dayoy = decodeDayOfYear(vdate); const auto dayoy = decodeDayOfYear(vdate);
if (dayoy < 0 || dayoy >= MaxDays) cdoAbort("Day of year %d out of range (date=%d)!", dayoy, vdate); if (dayoy < 0 || dayoy >= MaxDays) cdoAbort("Day of year %d out of range (date=%d)!", dayoy, vdate);
......
...@@ -35,7 +35,6 @@ void * ...@@ -35,7 +35,6 @@ void *
Ydaypctl(void *process) Ydaypctl(void *process)
{ {
constexpr int MaxDays = 373; constexpr int MaxDays = 373;
int nrecs;
size_t nmiss; size_t nmiss;
int64_t vdates1[MaxDays] = { 0 }, vdates2[MaxDays] = { 0 }; int64_t vdates1[MaxDays] = { 0 }, vdates2[MaxDays] = { 0 };
int vtimes1[MaxDays] = { 0 }; int vtimes1[MaxDays] = { 0 };
...@@ -87,8 +86,11 @@ Ydaypctl(void *process) ...@@ -87,8 +86,11 @@ Ydaypctl(void *process)
field.resize(gridsizemax); field.resize(gridsizemax);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID2, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID2, tsID);
if (nrecs == 0) break;
if (nrecs != cdoStreamInqTimestep(streamID3, tsID)) if (nrecs != cdoStreamInqTimestep(streamID3, tsID))
cdoAbort("Number of records at time step %d of %s and %s differ!", tsID + 1, cdoGetStreamName(1), cdoGetStreamName(2)); cdoAbort("Number of records at time step %d of %s and %s differ!", tsID + 1, cdoGetStreamName(1), cdoGetStreamName(2));
...@@ -138,8 +140,11 @@ Ydaypctl(void *process) ...@@ -138,8 +140,11 @@ Ydaypctl(void *process)
} }
tsID = 0; tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
const auto vdate = taxisInqVdate(taxisID1); const auto vdate = taxisInqVdate(taxisID1);
const auto vtime = taxisInqVtime(taxisID1); const auto vtime = taxisInqVtime(taxisID1);
......
...@@ -91,7 +91,6 @@ void * ...@@ -91,7 +91,6 @@ void *
Ydaystat(void *process) Ydaystat(void *process)
{ {
constexpr int MaxDays = 373; constexpr int MaxDays = 373;
int nrecs;
int dayoy_nsets[MaxDays] = { 0 }; int dayoy_nsets[MaxDays] = { 0 };
int64_t vdates[MaxDays] = { 0 }; int64_t vdates[MaxDays] = { 0 };
int vtimes[MaxDays] = { 0 }; int vtimes[MaxDays] = { 0 };
...@@ -139,8 +138,11 @@ Ydaystat(void *process) ...@@ -139,8 +138,11 @@ Ydaystat(void *process)
int tsID = 0; int tsID = 0;
int otsID = 0; int otsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
const auto vdate = taxisInqVdate(taxisID1); const auto vdate = taxisInqVdate(taxisID1);
const auto vtime = taxisInqVtime(taxisID1); const auto vtime = taxisInqVtime(taxisID1);
......
...@@ -38,7 +38,6 @@ void * ...@@ -38,7 +38,6 @@ void *
Ydrunpctl(void *process) Ydrunpctl(void *process)
{ {
constexpr int MaxDays = 373; constexpr int MaxDays = 373;
int nrecs;
int its; int its;
size_t nmiss; size_t nmiss;
int64_t vdates1[MaxDays] = { 0 }, vdates2[MaxDays] = { 0 }; int64_t vdates1[MaxDays] = { 0 }, vdates2[MaxDays] = { 0 };
...@@ -117,8 +116,11 @@ Ydrunpctl(void *process) ...@@ -117,8 +116,11 @@ Ydrunpctl(void *process)
int tsID = 0; int tsID = 0;
int startYear = 0, endYear = 0, mon = 0, day = 0; int startYear = 0, endYear = 0, mon = 0, day = 0;
while ((nrecs = cdoStreamInqTimestep(streamID2, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID2, tsID);
if (nrecs == 0) break;
if (nrecs != cdoStreamInqTimestep(streamID3, tsID)) if (nrecs != cdoStreamInqTimestep(streamID3, tsID))
cdoAbort("Number of records at time step %d of %s and %s differ!", tsID + 1, cdoGetStreamName(1), cdoGetStreamName(2)); cdoAbort("Number of records at time step %d of %s and %s differ!", tsID + 1, cdoGetStreamName(1), cdoGetStreamName(2));
...@@ -170,7 +172,7 @@ Ydrunpctl(void *process) ...@@ -170,7 +172,7 @@ Ydrunpctl(void *process)
for (tsID = 0; tsID < ndates; tsID++) for (tsID = 0; tsID < ndates; tsID++)
{ {
nrecs = cdoStreamInqTimestep(streamID1, tsID); const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) cdoAbort("File has less then %d timesteps!", ndates); if (nrecs == 0) cdoAbort("File has less then %d timesteps!", ndates);
datetime[tsID].date = taxisInqVdate(taxisID1); datetime[tsID].date = taxisInqVdate(taxisID1);
...@@ -226,7 +228,7 @@ Ydrunpctl(void *process) ...@@ -226,7 +228,7 @@ Ydrunpctl(void *process)
vars1[inp] = vars1[inp + 1]; vars1[inp] = vars1[inp + 1];
} }
nrecs = cdoStreamInqTimestep(streamID1, tsID); const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break; if (nrecs == 0) break;
datetime[ndates - 1].date = taxisInqVdate(taxisID1); datetime[ndates - 1].date = taxisInqVdate(taxisID1);
...@@ -254,10 +256,10 @@ Ydrunpctl(void *process) ...@@ -254,10 +256,10 @@ Ydrunpctl(void *process)
int missTimes = 0; int missTimes = 0;
for ( missTimes = 0; missTimes < ndates-1; missTimes++ ) for ( missTimes = 0; missTimes < ndates-1; missTimes++ )
{ {
int year; const auto nrecs = streamInqTimestep(cdiStream, missTimes);
nrecs = streamInqTimestep(cdiStream, missTimes);
if (nrecs == 0) break; if (nrecs == 0) break;
int year;
cdiDecodeDate(taxisInqVdate(cdiTaxisID), &year, &mon, &day); cdiDecodeDate(taxisInqVdate(cdiTaxisID), &year, &mon, &day);
datetime[ndates - 1].date = cdiEncodeDate(endYear+1, mon, day); datetime[ndates - 1].date = cdiEncodeDate(endYear+1, mon, day);
datetime[ndates - 1].time = taxisInqVtime(cdiTaxisID); datetime[ndates - 1].time = taxisInqVtime(cdiTaxisID);
......
...@@ -56,7 +56,6 @@ addOperators(void) ...@@ -56,7 +56,6 @@ addOperators(void)
void * void *
Yeararith(void *process) Yeararith(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
cdoInitialize(process); cdoInitialize(process);
...@@ -101,15 +100,20 @@ Yeararith(void *process) ...@@ -101,15 +100,20 @@ Yeararith(void *process)
int year2last = 0; int year2last = 0;
int tsID2 = 0; int tsID2 = 0;
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
const auto year = getYear(taxisInqVdate(taxisID1)); const auto year = getYear(taxisInqVdate(taxisID1));
if (year > year0) if (year > year0)
{ {
bool lfound = false; bool lfound = false;
int nrecs2; while (true)
while ((nrecs2 = cdoStreamInqTimestep(streamID2, tsID2)))
{ {
const auto nrecs2 = cdoStreamInqTimestep(streamID2, tsID2);
if (nrecs2 == 0) break;
tsID2++; tsID2++;
const auto year2 = getYear(taxisInqVdate(taxisID2)); const auto year2 = getYear(taxisInqVdate(taxisID2));
if (year == year2) if (year == year2)
......
...@@ -38,7 +38,6 @@ Yearmonstat(void *process) ...@@ -38,7 +38,6 @@ Yearmonstat(void *process)
TimeStat timestat_date = TimeStat::MEAN; TimeStat timestat_date = TimeStat::MEAN;
int64_t vdate0 = 0; int64_t vdate0 = 0;
int vtime0 = 0; int vtime0 = 0;
int nrecs;
int year0 = 0, month0 = 0; int year0 = 0, month0 = 0;
int year, month, day; int year, month, day;
...@@ -93,10 +92,14 @@ Yearmonstat(void *process) ...@@ -93,10 +92,14 @@ Yearmonstat(void *process)
int otsID = 0; int otsID = 0;
while (true) while (true)
{ {
int nrecs = 0;
long nsets = 0; long nsets = 0;
double dsets = 0; double dsets = 0.0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
dtlist.taxisInqTimestep(taxisID1, nsets); dtlist.taxisInqTimestep(taxisID1, nsets);
const auto vdate = dtlist.getVdate(nsets); const auto vdate = dtlist.getVdate(nsets);
const auto vtime = dtlist.getVtime(nsets); const auto vtime = dtlist.getVtime(nsets);
...@@ -113,7 +116,7 @@ Yearmonstat(void *process) ...@@ -113,7 +116,7 @@ Yearmonstat(void *process)
cdoAbort("Month does not change!"); cdoAbort("Month does not change!");
} }
const int dpm = days_per_month(calendar, year, month); const auto dpm = days_per_month(calendar, year, month);
for (int recID = 0; recID < nrecs; recID++) for (int recID = 0; recID < nrecs; recID++)
{ {
......
...@@ -48,7 +48,6 @@ getHourOfYearIndex(int64_t vdate, int vtime) ...@@ -48,7 +48,6 @@ getHourOfYearIndex(int64_t vdate, int vtime)
void * void *
Yhourarith(void *process) Yhourarith(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
cdoInitialize(process); cdoInitialize(process);
...@@ -91,8 +90,11 @@ Yhourarith(void *process) ...@@ -91,8 +90,11 @@ Yhourarith(void *process)
FieldVector2D vars2[MaxHours]; FieldVector2D vars2[MaxHours];
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID2, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID2, tsID);
if (nrecs == 0) break;
const auto houroy = getHourOfYearIndex(taxisInqVdate(taxisID2), taxisInqVtime(taxisID2)); const auto houroy = getHourOfYearIndex(taxisInqVdate(taxisID2), taxisInqVtime(taxisID2));
if (vars2[houroy].size() > 0) cdoAbort("Hour of year index %d already allocated!", houroy); if (vars2[houroy].size() > 0) cdoAbort("Hour of year index %d already allocated!", houroy);
...@@ -110,8 +112,11 @@ Yhourarith(void *process) ...@@ -110,8 +112,11 @@ Yhourarith(void *process)
} }
tsID = 0; tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
const auto houroy = getHourOfYearIndex(taxisInqVdate(taxisID1), taxisInqVtime(taxisID1)); const auto houroy = getHourOfYearIndex(taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
if (vars2[houroy].size() == 0) cdoAbort("Hour of year index %d not found!", houroy); if (vars2[houroy].size() == 0) cdoAbort("Hour of year index %d not found!", houroy);
......
...@@ -81,7 +81,6 @@ void * ...@@ -81,7 +81,6 @@ void *
Yhourstat(void *process) Yhourstat(void *process)
{ {
TimeStat timestat_date = TimeStat::LAST; TimeStat timestat_date = TimeStat::LAST;
int nrecs;
cdoInitialize(process); cdoInitialize(process);
...@@ -137,8 +136,11 @@ Yhourstat(void *process) ...@@ -137,8 +136,11 @@ Yhourstat(void *process)
int tsID = 0; int tsID = 0;
int otsID = 0; int otsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
const auto vdate = taxisInqVdate(taxisID1); const auto vdate = taxisInqVdate(taxisID1);
const auto vtime = taxisInqVtime(taxisID1); const auto vtime = taxisInqVtime(taxisID1);
...@@ -240,7 +242,7 @@ Yhourstat(void *process) ...@@ -240,7 +242,7 @@ Yhourstat(void *process)
for (int hourot = 0; hourot < MaxHours; ++hourot) for (int hourot = 0; hourot < MaxHours; ++hourot)
if (hourot_nsets[hourot]) if (hourot_nsets[hourot])
{ {
const int nsets = hourot_nsets[hourot]; const auto nsets = hourot_nsets[hourot];
for (int recID = 0; recID < maxrecs; recID++) for (int recID = 0; recID < maxrecs; recID++)
{ {
if (recList[recID].lconst) continue; if (recList[recID].lconst) continue;
......
...@@ -92,7 +92,6 @@ addOperators(void) ...@@ -92,7 +92,6 @@ addOperators(void)
void * void *
Ymonarith(void *process) Ymonarith(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
const char *seas_names[4]; const char *seas_names[4];
...@@ -136,9 +135,12 @@ Ymonarith(void *process) ...@@ -136,9 +135,12 @@ Ymonarith(void *process)
FieldVector2D vars2[MaxMonths]; FieldVector2D vars2[MaxMonths];
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID2, tsID))) while (true)
{ {
int mon = getMonthIndex(taxisInqVdate(taxisID2)); const auto nrecs = cdoStreamInqTimestep(streamID2, tsID);
if (nrecs == 0) break;
auto mon = getMonthIndex(taxisInqVdate(taxisID2));
if (opertype == SEASONAL) mon = monthToSeason(mon + 1); if (opertype == SEASONAL) mon = monthToSeason(mon + 1);
if (vars2[mon].size()) alreadyAllocated(opertype == SEASONAL, mon, seas_names); if (vars2[mon].size()) alreadyAllocated(opertype == SEASONAL, mon, seas_names);
...@@ -156,8 +158,11 @@ Ymonarith(void *process) ...@@ -156,8 +158,11 @@ Ymonarith(void *process)
} }
tsID = 0; tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
auto mon = getMonthIndex(taxisInqVdate(taxisID1)); auto mon = getMonthIndex(taxisInqVdate(taxisID1));
if (opertype == SEASONAL) mon = monthToSeason(mon + 1); if (opertype == SEASONAL) mon = monthToSeason(mon + 1);
if (vars2[mon].size() == 0) notFound(opertype == SEASONAL, mon, seas_names); if (vars2[mon].size() == 0) notFound(opertype == SEASONAL, mon, seas_names);
......
...@@ -36,7 +36,6 @@ Ymonpctl(void *process) ...@@ -36,7 +36,6 @@ Ymonpctl(void *process)
{ {
constexpr int MaxMonths = 17; constexpr int MaxMonths = 17;
size_t nmiss; size_t nmiss;
int nrecs;
int64_t vdates1[MaxMonths] = { 0 }, vdates2[MaxMonths] = { 0 }; int64_t vdates1[MaxMonths] = { 0 }, vdates2[MaxMonths] = { 0 };
int vtimes1[MaxMonths] = { 0 };