Commit 084a9403 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Changed initialization of some variables.

parent a4d66c5c
......@@ -94,8 +94,8 @@ timpctl(int operatorID)
for (int varID = 0; varID < nvars; varID++)
{
auto gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
auto nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
const auto gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
const auto nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
hset.createVarLevels(varID, nlevels, gridsize);
}
......
......@@ -37,9 +37,9 @@ Ydaypctl(void *process)
constexpr int MaxDays = 373;
int nrecs;
size_t nmiss;
int64_t vdates1[MaxDays], vdates2[MaxDays];
int vtimes1[MaxDays];
long nsets[MaxDays];
int64_t vdates1[MaxDays] = { 0 }, vdates2[MaxDays] = { 0 };
int vtimes1[MaxDays] = { 0 };
long nsets[MaxDays] = { 0 };
FieldVector2D vars1[MaxDays];
HistogramSet hsets[MaxDays];
......@@ -49,8 +49,6 @@ Ydaypctl(void *process)
operatorInputArg("percentile number");
const auto pn = parameter2double(cdoOperatorArgv(0));
for (int dayoy = 0; dayoy < MaxDays; dayoy++) nsets[dayoy] = 0;
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const auto streamID3 = cdoOpenRead(2);
......
......@@ -92,9 +92,9 @@ Ydaystat(void *process)
{
constexpr int MaxDays = 373;
int nrecs;
int dayoy_nsets[MaxDays];
int64_t vdates[MaxDays];
int vtimes[MaxDays];
int dayoy_nsets[MaxDays] = { 0 };
int64_t vdates[MaxDays] = { 0 };
int vtimes[MaxDays] = { 0 };
FieldVector2D vars1[MaxDays], vars2[MaxDays], samp1[MaxDays];
cdoInitialize(process);
......@@ -113,8 +113,6 @@ Ydaystat(void *process)
const int divisor = operfunc == func_std1 || operfunc == func_var1;
const bool lvars2 = lvarstd || lrange;
for (int dayoy = 0; dayoy < MaxDays; ++dayoy) dayoy_nsets[dayoy] = 0;
const auto streamID1 = cdoOpenRead(0);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
......
......@@ -41,9 +41,9 @@ Ydrunpctl(void *process)
int nrecs;
int its;
size_t nmiss;
int64_t vdates1[MaxDays], vdates2[MaxDays];
int vtimes1[MaxDays] /*, vtimes2[MaxDays]*/;
int nsets[MaxDays];
int64_t vdates1[MaxDays] = { 0 }, vdates2[MaxDays] = { 0 };
int vtimes1[MaxDays] = { 0 } /*, vtimes2[MaxDays]*/;
int nsets[MaxDays] = { 0 };
FieldVector2D vars2[MaxDays];
HistogramSet hsets[MaxDays];
......@@ -70,8 +70,6 @@ Ydrunpctl(void *process)
if ( percMethod && strcmp(percMethod,"r8") == 0 ) percentile_set_method("rtype8");
for (int dayoy = 0; dayoy < MaxDays; dayoy++) nsets[dayoy] = 0;
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const auto streamID3 = cdoOpenRead(2);
......
......@@ -42,22 +42,14 @@ constexpr int MaxDays = 373;
class YDAY_STATS
{
public:
int64_t vdate[MaxDays];
int vtime[MaxDays];
int64_t vdate[MaxDays] = { 0 };
int vtime[MaxDays] = { 0 };
int nsets[MaxDays] = { 0 };
FieldVector2D vars1[MaxDays];
FieldVector2D vars2[MaxDays];
int nsets[MaxDays];
int vlist;
YDAY_STATS(int vlistID) : vlist(vlistID)
{
for (int dayoy = 0; dayoy < MaxDays; dayoy++)
{
vdate[dayoy] = 0;
vtime[dayoy] = 0;
nsets[dayoy] = 0;
}
}
YDAY_STATS(int vlistID) : vlist(vlistID) { }
};
static void
......@@ -326,16 +318,16 @@ Ydrunstat(void *process)
if (readMethod == 'c' && cdoAssertFilesOnly() )
{
cdiDecodeDate(datetime[ndates - 1].date, &endYear, &mon, &day);
CdiStreamID cdiStream = streamOpenRead(cdoGetStreamName(0));
const auto cdiStream = streamOpenRead(cdoGetStreamName(0));
const auto cdiVlistID = streamInqVlist(cdiStream);
const auto cdiTaxisID = vlistInqTaxis(cdiVlistID);
int missTimes = 0;
for ( missTimes = 0; missTimes < ndates-1; missTimes++ )
{
int year;
const auto nrecs = streamInqTimestep(cdiStream, missTimes);
if (nrecs == 0) break;
int year;
cdiDecodeDate(taxisInqVdate(cdiTaxisID), &year, &mon, &day);
datetime[ndates - 1].date = cdiEncodeDate(endYear+1, mon, day);
datetime[ndates - 1].time = taxisInqVtime(cdiTaxisID);
......
......@@ -37,9 +37,9 @@ Ymonpctl(void *process)
constexpr int MaxMonths = 17;
size_t nmiss;
int nrecs;
int64_t vdates1[MaxMonths], vdates2[MaxMonths];
int vtimes1[MaxMonths];
long nsets[MaxMonths];
int64_t vdates1[MaxMonths] = { 0 }, vdates2[MaxMonths] = { 0 };
int vtimes1[MaxMonths] = { 0 };
long nsets[MaxMonths] = { 0 };
FieldVector2D vars1[MaxMonths];
HistogramSet hsets[MaxMonths];
......@@ -49,8 +49,6 @@ Ymonpctl(void *process)
operatorInputArg("percentile number");
const auto pn = parameter2double(cdoOperatorArgv(0));
for (int month = 0; month < MaxMonths; month++) nsets[month] = 0;
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const auto streamID3 = cdoOpenRead(2);
......
......@@ -60,10 +60,10 @@ Ymonstat(void *process)
{
constexpr int MaxMonths = 17;
int nrecs;
int month_nsets[MaxMonths];
int64_t vdates[MaxMonths];
int vtimes[MaxMonths];
int mon[MaxMonths];
int month_nsets[MaxMonths] = { 0 };
int64_t vdates[MaxMonths] = { 0 };
int vtimes[MaxMonths] = { 0 };
int mon[MaxMonths] = { 0 };
int nmon = 0;
FieldVector2D vars1[MaxMonths], vars2[MaxMonths], samp1[MaxMonths];
......@@ -81,8 +81,6 @@ Ymonstat(void *process)
const int divisor = operfunc == func_std1 || operfunc == func_var1;
const bool lvars2 = lvarstd || lrange;
for (int month = 0; month < MaxMonths; month++) month_nsets[month] = 0;
operatorCheckArgc(0);
const auto streamID1 = cdoOpenRead(0);
......
......@@ -38,7 +38,7 @@ Yseaspctl(void *process)
constexpr int MaxSeasons = 4;
int nrecs;
size_t nmiss;
long nsets[MaxSeasons];
long nsets[MaxSeasons] = { 0 };
CdoDateTime datetime1[MaxSeasons], datetime2[MaxSeasons];
FieldVector2D vars1[MaxSeasons];
HistogramSet hsets[MaxSeasons];
......@@ -49,15 +49,6 @@ Yseaspctl(void *process)
operatorInputArg("percentile number");
const auto pn = parameter2double(cdoOperatorArgv(0));
for (int seas = 0; seas < MaxSeasons; seas++)
{
nsets[seas] = 0;
datetime1[seas].date = 0;
datetime1[seas].time = 0;
datetime2[seas].date = 0;
datetime2[seas].time = 0;
}
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
const auto streamID3 = cdoOpenRead(2);
......
......@@ -59,7 +59,7 @@ Yseasstat(void *process)
{
constexpr int MaxSeasons = 4;
int nrecs;
int seas_nsets[MaxSeasons];
int seas_nsets[MaxSeasons] = { 0 };
CdoDateTime datetime[MaxSeasons];
FieldVector2D vars1[MaxSeasons], vars2[MaxSeasons], samp1[MaxSeasons];
......@@ -77,13 +77,6 @@ Yseasstat(void *process)
const int divisor = operfunc == func_std1 || operfunc == func_var1;
const bool lvars2 = lvarstd || lrange;
for (int seas = 0; seas < MaxSeasons; seas++)
{
seas_nsets[seas] = 0;
datetime[seas].date = 0;
datetime[seas].time = 0;
}
operatorCheckArgc(0);
const auto streamID1 = cdoOpenRead(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