Commit 30c60cd5 authored by Uwe Schulzweida's avatar Uwe Schulzweida

Changed while statement for cdoStreamInqTimestep().

parent 13d51674
Pipeline #5717 failed with stages
in 13 minutes and 34 seconds
...@@ -313,7 +313,6 @@ smoothGetParameter(int &xnsmooth, SmoothPoint &spoint) ...@@ -313,7 +313,6 @@ smoothGetParameter(int &xnsmooth, SmoothPoint &spoint)
void * void *
Smooth(void *process) Smooth(void *process)
{ {
int nrecs;
int xnsmooth = 1; int xnsmooth = 1;
SmoothPoint spoint; SmoothPoint spoint;
...@@ -379,8 +378,11 @@ Smooth(void *process) ...@@ -379,8 +378,11 @@ Smooth(void *process)
cdoDefVlist(streamID2, vlistID2); cdoDefVlist(streamID2, vlistID2);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
cdoDefTimestep(streamID2, tsID); cdoDefTimestep(streamID2, tsID);
......
...@@ -102,7 +102,7 @@ Sort(void *process) ...@@ -102,7 +102,7 @@ Sort(void *process)
{ {
int varID, levelID, zaxisID; int varID, levelID, zaxisID;
int vindex, lindex; int vindex, lindex;
int nrecs, nlevs; int nlevs;
size_t nmiss; size_t nmiss;
bool (*cmpvarlev)(const LevInfo &a, const LevInfo &b) = cmpvarlevel; bool (*cmpvarlev)(const LevInfo &a, const LevInfo &b) = cmpvarlevel;
...@@ -165,8 +165,11 @@ Sort(void *process) ...@@ -165,8 +165,11 @@ Sort(void *process)
} }
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
cdoDefTimestep(streamID2, tsID); cdoDefTimestep(streamID2, tsID);
......
...@@ -50,7 +50,6 @@ cmpdatetime(const TimeInfo &a, const TimeInfo &b) ...@@ -50,7 +50,6 @@ cmpdatetime(const TimeInfo &a, const TimeInfo &b)
void * void *
Sorttimestamp(void *process) Sorttimestamp(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
int lasttsID = -1; int lasttsID = -1;
int nalloc = 0; int nalloc = 0;
...@@ -103,8 +102,11 @@ Sorttimestamp(void *process) ...@@ -103,8 +102,11 @@ Sorttimestamp(void *process)
nvars = vlistNvars(vlistID1); nvars = vlistNvars(vlistID1);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
if (xtsID >= nalloc) if (xtsID >= nalloc)
{ {
constexpr int NALLOC_INC = 1024; constexpr int NALLOC_INC = 1024;
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
void * void *
Spectral(void *process) Spectral(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
int gridID1 = -1, gridID2 = -1; int gridID1 = -1, gridID2 = -1;
size_t nmiss; size_t nmiss;
...@@ -211,8 +210,11 @@ Spectral(void *process) ...@@ -211,8 +210,11 @@ Spectral(void *process)
if (gridID2 != -1) array2.resize(gridInqSize(gridID2)); if (gridID2 != -1) array2.resize(gridInqSize(gridID2));
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
cdoDefTimestep(streamID2, tsID); cdoDefTimestep(streamID2, tsID);
......
...@@ -141,7 +141,6 @@ spectrum(int nrec, double *data, double *spectrum, double *real, double *imag, c ...@@ -141,7 +141,6 @@ spectrum(int nrec, double *data, double *spectrum, double *real, double *imag, c
void * void *
Spectrum(void *process) Spectrum(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
int k; int k;
int nalloc = 0; int nalloc = 0;
...@@ -171,8 +170,11 @@ Spectrum(void *process) ...@@ -171,8 +170,11 @@ Spectrum(void *process)
std::vector<int> vtime; std::vector<int> vtime;
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
if (tsID >= nalloc) if (tsID >= nalloc)
{ {
constexpr int NALLOC_INC = 1024; constexpr int NALLOC_INC = 1024;
......
...@@ -36,7 +36,6 @@ Timcount(void *process) ...@@ -36,7 +36,6 @@ Timcount(void *process)
char indate1[DATE_LEN + 1], indate2[DATE_LEN + 1]; char indate1[DATE_LEN + 1], indate2[DATE_LEN + 1];
int64_t vdate0 = 0; int64_t vdate0 = 0;
int vtime0 = 0; int vtime0 = 0;
int nrecs;
cdoInitialize(process); cdoInitialize(process);
...@@ -87,9 +86,13 @@ Timcount(void *process) ...@@ -87,9 +86,13 @@ Timcount(void *process)
int otsID = 0; int otsID = 0;
while (true) while (true)
{ {
int nrecs = 0;
int nsets = 0; int nsets = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
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);
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
void * void *
Timcumsum(void *process) Timcumsum(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
cdoInitialize(process); cdoInitialize(process);
...@@ -57,8 +56,11 @@ Timcumsum(void *process) ...@@ -57,8 +56,11 @@ Timcumsum(void *process)
fieldsFromVlist(vlistID1, vars1, FIELD_VEC); fieldsFromVlist(vlistID1, vars1, FIELD_VEC);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
cdoDefTimestep(streamID2, tsID); cdoDefTimestep(streamID2, tsID);
......
...@@ -40,7 +40,6 @@ timpctl(int operatorID) ...@@ -40,7 +40,6 @@ timpctl(int operatorID)
{ {
TimeStat timestat_date = TimeStat::MEAN; TimeStat timestat_date = TimeStat::MEAN;
char indate1[DATE_LEN + 1], indate2[DATE_LEN + 1]; char indate1[DATE_LEN + 1], indate2[DATE_LEN + 1];
int nrecs;
size_t nmiss; size_t nmiss;
operatorInputArg("percentile number"); operatorInputArg("percentile number");
...@@ -106,7 +105,7 @@ timpctl(int operatorID) ...@@ -106,7 +105,7 @@ timpctl(int operatorID)
int otsID = 0; int otsID = 0;
while (true) while (true)
{ {
nrecs = cdoStreamInqTimestep(streamID2, otsID); auto nrecs = cdoStreamInqTimestep(streamID2, otsID);
if (nrecs != cdoStreamInqTimestep(streamID3, otsID)) if (nrecs != cdoStreamInqTimestep(streamID3, otsID))
cdoAbort("Number of records at time step %d of %s and %s differ!", otsID + 1, cdoGetStreamName(1), cdoGetStreamName(2)); cdoAbort("Number of records at time step %d of %s and %s differ!", otsID + 1, cdoGetStreamName(1), cdoGetStreamName(2));
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
void * void *
Timsort(void *process) Timsort(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
int nalloc = 0; int nalloc = 0;
...@@ -64,8 +63,11 @@ Timsort(void *process) ...@@ -64,8 +63,11 @@ Timsort(void *process)
std::vector<int> vtime; std::vector<int> vtime;
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
if (tsID >= nalloc) if (tsID >= nalloc)
{ {
constexpr int NALLOC_INC = 1024; constexpr int NALLOC_INC = 1024;
...@@ -99,8 +101,8 @@ Timsort(void *process) ...@@ -99,8 +101,8 @@ Timsort(void *process)
{ {
if (vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT) continue; if (vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT) continue;
auto memType = varList[varID].memType; const auto memType = varList[varID].memType;
auto gridsize = varList[varID].gridsize; const auto gridsize = varList[varID].gridsize;
for (levelID = 0; levelID < varList[varID].nlevels; levelID++) for (levelID = 0; levelID < varList[varID].nlevels; levelID++)
{ {
#ifdef _OPENMP #ifdef _OPENMP
......
...@@ -202,9 +202,8 @@ Timstat2(void *process) ...@@ -202,9 +202,8 @@ Timstat2(void *process)
varListInit(varList2, vlistID2); varListInit(varList2, vlistID2);
const auto nvars = vlistNvars(vlistID1); const auto nvars = vlistNvars(vlistID1);
auto nrecs = vlistNrecs(vlistID1); const auto nrecs1 = vlistNrecs(vlistID1);
const int nrecs3 = nrecs; std::vector<int> recVarID(nrecs1), recLevelID(nrecs1);
std::vector<int> recVarID(nrecs), recLevelID(nrecs);
const auto taxisID1 = vlistInqTaxis(vlistID1); const auto taxisID1 = vlistInqTaxis(vlistID1);
// const auto taxisID2 = vlistInqTaxis(vlistID2); // const auto taxisID2 = vlistInqTaxis(vlistID2);
...@@ -241,12 +240,15 @@ Timstat2(void *process) ...@@ -241,12 +240,15 @@ Timstat2(void *process)
} }
int tsID = 0; int tsID = 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);
auto nrecs2 = cdoStreamInqTimestep(streamID2, tsID); const auto nrecs2 = cdoStreamInqTimestep(streamID2, tsID);
if (nrecs != nrecs2) cdoWarning("Input streams have different number of records!"); if (nrecs != nrecs2) cdoWarning("Input streams have different number of records!");
for (int recID = 0; recID < nrecs; recID++) for (int recID = 0; recID < nrecs; recID++)
...@@ -294,7 +296,7 @@ Timstat2(void *process) ...@@ -294,7 +296,7 @@ Timstat2(void *process)
taxisDefVtime(taxisID3, vtime); taxisDefVtime(taxisID3, vtime);
cdoDefTimestep(streamID3, tsID); cdoDefTimestep(streamID3, tsID);
for (int recID = 0; recID < nrecs3; recID++) for (int recID = 0; recID < nrecs1; recID++)
{ {
varID = recVarID[recID]; varID = recVarID[recID];
levelID = recLevelID[recID]; levelID = recLevelID[recID];
......
...@@ -102,7 +102,6 @@ Vertintap(void *process) ...@@ -102,7 +102,6 @@ Vertintap(void *process)
type_lin, type_lin,
type_log type_log
}; };
int nrecs;
int varID, levelID; int varID, levelID;
int nhlev = 0, nhlevf = 0, nhlevh = 0; int nhlev = 0, nhlevf = 0, nhlevh = 0;
int apressID = -1, dpressID = -1; int apressID = -1, dpressID = -1;
...@@ -282,7 +281,7 @@ Vertintap(void *process) ...@@ -282,7 +281,7 @@ Vertintap(void *process)
if (useHeightLevel) if (useHeightLevel)
{ {
std::vector<double> phlev(nplev); Varray<double> phlev(nplev);
height2pressure(phlev.data(), plev.data(), nplev); height2pressure(phlev.data(), plev.data(), nplev);
if (Options::cdoVerbose) if (Options::cdoVerbose)
...@@ -339,8 +338,11 @@ Vertintap(void *process) ...@@ -339,8 +338,11 @@ Vertintap(void *process)
cdoDefVlist(streamID2, vlistID2); cdoDefVlist(streamID2, vlistID2);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
for (varID = 0; varID < nvars; ++varID) for (varID = 0; varID < nvars; ++varID)
{ {
vars[varID] = false; vars[varID] = false;
......
...@@ -53,7 +53,6 @@ is_height_axis(int zaxisID) ...@@ -53,7 +53,6 @@ is_height_axis(int zaxisID)
void * void *
Vertintgh(void *process) Vertintgh(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
int f_heightID = -1, h_heightID = -1;; int f_heightID = -1, h_heightID = -1;;
char stdname[CDI_MAX_NAME]; char stdname[CDI_MAX_NAME];
...@@ -236,8 +235,11 @@ Vertintgh(void *process) ...@@ -236,8 +235,11 @@ Vertintgh(void *process)
cdoDefVlist(streamID2, vlistID2); cdoDefVlist(streamID2, vlistID2);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
for (varID = 0; varID < nvars; ++varID) for (varID = 0; varID < nvars; ++varID)
{ {
vars[varID] = false; vars[varID] = false;
......
...@@ -109,7 +109,6 @@ Vertintml(void *process) ...@@ -109,7 +109,6 @@ Vertintml(void *process)
type_lin, type_lin,
type_log type_log
}; };
int nrecs;
int varID, levelID; int varID, levelID;
bool sgeopot_needed = false; bool sgeopot_needed = false;
bool extrapolate = false; bool extrapolate = false;
...@@ -471,8 +470,11 @@ Vertintml(void *process) ...@@ -471,8 +470,11 @@ Vertintml(void *process)
cdoDefVlist(streamID2, vlistID2); cdoDefVlist(streamID2, vlistID2);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
for (varID = 0; varID < nvars; ++varID) vars[varID] = false; for (varID = 0; varID < nvars; ++varID) vars[varID] = false;
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
......
...@@ -175,7 +175,6 @@ vertstatGetParameter(bool *weights, bool *genbounds) ...@@ -175,7 +175,6 @@ vertstatGetParameter(bool *weights, bool *genbounds)
void * void *
Vertstat(void *process) Vertstat(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
struct VertInfo struct VertInfo
{ {
...@@ -294,8 +293,11 @@ Vertstat(void *process) ...@@ -294,8 +293,11 @@ Vertstat(void *process)
} }
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
cdoDefTimestep(streamID2, tsID); cdoDefTimestep(streamID2, tsID);
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
void * void *
Vertwind(void *process) Vertwind(void *process)
{ {
int nrecs;
int varID, levelID; int varID, levelID;
int nvct = 0; int nvct = 0;
size_t nmiss; size_t nmiss;
...@@ -160,8 +159,11 @@ Vertwind(void *process) ...@@ -160,8 +159,11 @@ Vertwind(void *process)
cdoDefVlist(streamID2, vlistID2); cdoDefVlist(streamID2, vlistID2);
int tsID = 0; int tsID = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID))) while (true)
{ {
const auto nrecs = cdoStreamInqTimestep(streamID1, tsID);
if (nrecs == 0) break;
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
cdoDefTimestep(streamID2, tsID); cdoDefTimestep(streamID2, tsID);
......
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