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

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