Commit eca25789 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Set type of initialized variables to auto.

parent ba70fc37
......@@ -23,9 +23,10 @@
#include <cdi.h>
#include "process_int.h"
#include "cdo_season.h"
#include "datetime.h"
#include "process_int.h"
void *
Seascount(void *process)
......@@ -34,28 +35,28 @@ Seascount(void *process)
int vtime0 = 0;
int nrecs;
int varID, levelID;
int year, month, day, seas0 = 0;
int seas0 = 0;
int oldmon = 0;
cdoInitialize(process);
cdoOperatorAdd("seascount", 0, 0, nullptr);
const int season_start = getSeasonStart();
const auto season_start = getSeasonStart();
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID2 = vlistDuplicate(vlistID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const auto streamID2 = cdoOpenWrite(1);
cdoDefVlist(streamID2, vlistID2);
const int maxrecs = vlistNrecs(vlistID1);
const auto maxrecs = vlistNrecs(vlistID1);
std::vector<RecordInfo> recList(maxrecs);
auto gridsizemax = vlistGridsizeMax(vlistID1);
......@@ -77,12 +78,12 @@ Seascount(void *process)
{
const auto vdate = taxisInqVdate(taxisID1);
const auto vtime = taxisInqVtime(taxisID1);
cdiDecodeDate(vdate, &year, &month, &day);
int newmon = month;
const auto month = decodeMonth(vdate);
auto newmon = month;
if (season_start == START_DEC && newmon == 12) newmon = 0;
const int seas = monthToSeason(month);
const auto seas = monthToSeason(month);
if (nsets == 0)
{
......@@ -138,8 +139,8 @@ Seascount(void *process)
{
if (otsID && recList[recID].lconst) continue;
const int varID = recList[recID].varID;
const int levelID = recList[recID].levelID;
const auto varID = recList[recID].varID;
const auto levelID = recList[recID].levelID;
cdoDefRecord(streamID2, varID, levelID);
cdoWriteRecord(streamID2, vars1[varID][levelID].vec.data(), vars1[varID][levelID].nmiss);
}
......
......@@ -39,10 +39,9 @@ Seaspctl(void *process)
TimeStat timestat_date = TimeStat::MEAN;
int nrecs;
int varID, levelID;
int year, month, day, seas0 = 0;
int seas0 = 0;
size_t nmiss;
int oldmon = 0;
int season_start;
cdoInitialize(process);
......@@ -52,7 +51,7 @@ Seaspctl(void *process)
const auto pn = parameter2double(cdoOperatorArgv(0));
percentile_check_number(pn);
season_start = getSeasonStart();
const auto season_start = getSeasonStart();
const auto streamID1 = cdoOpenRead(0);
const auto streamID2 = cdoOpenRead(1);
......@@ -142,8 +141,7 @@ Seaspctl(void *process)
dtlist.taxisInqTimestep(taxisID1, nsets);
const auto vdate1 = dtlist.getVdate(nsets);
cdiDecodeDate(vdate1, &year, &month, &day);
const auto month = decodeMonth(vdate1);
int newmon = month;
if (season_start == START_DEC && newmon == 12) newmon = 0;
......
......@@ -32,7 +32,6 @@
#include <cdi.h>
#include "cdo_options.h"
#include "functs.h"
#include "process_int.h"
......@@ -40,6 +39,24 @@
#include "printinfo.h"
#include "cdo_season.h"
static void
addOperators(void)
{
// clang-format off
cdoOperatorAdd("seasrange", func_range, 0, nullptr);
cdoOperatorAdd("seasmin", func_min, 0, nullptr);
cdoOperatorAdd("seasmax", func_max, 0, nullptr);
cdoOperatorAdd("seassum", func_sum, 0, nullptr);
cdoOperatorAdd("seasmean", func_mean, 0, nullptr);
cdoOperatorAdd("seasavg", func_avg, 0, nullptr);
cdoOperatorAdd("seasvar", func_var, 0, nullptr);
cdoOperatorAdd("seasvar1", func_var1, 0, nullptr);
cdoOperatorAdd("seasstd", func_std, 0, nullptr);
cdoOperatorAdd("seasstd1", func_std1, 0, nullptr);
// clang-format on
}
void *
Seasstat(void *process)
{
......@@ -48,24 +65,14 @@ Seasstat(void *process)
int vtime0 = 0, vtime1 = 0;
int nrecs;
int varID, levelID;
int year, month, day, seas0 = 0;
int seas0 = 0;
int oldmon = 0;
int nseason = 0;
const char *seas_name[4];
cdoInitialize(process);
// clang-format off
cdoOperatorAdd("seasrange", func_range, 0, nullptr);
cdoOperatorAdd("seasmin", func_min, 0, nullptr);
cdoOperatorAdd("seasmax", func_max, 0, nullptr);
cdoOperatorAdd("seassum", func_sum, 0, nullptr);
cdoOperatorAdd("seasmean", func_mean, 0, nullptr);
cdoOperatorAdd("seasavg", func_avg, 0, nullptr);
cdoOperatorAdd("seasvar", func_var, 0, nullptr);
cdoOperatorAdd("seasvar1", func_var1, 0, nullptr);
cdoOperatorAdd("seasstd", func_std, 0, nullptr);
cdoOperatorAdd("seasstd1", func_std1, 0, nullptr);
addOperators();
const auto operatorID = cdoOperatorID();
const auto operfunc = cdoOperatorF1(operatorID);
......@@ -75,7 +82,6 @@ Seasstat(void *process)
const bool lstd = operfunc == func_std || operfunc == func_std1;
const bool lvarstd = operfunc == func_std || operfunc == func_var || operfunc == func_std1 || operfunc == func_var1;
const int divisor = operfunc == func_std1 || operfunc == func_var1;
// clang-format on
const bool lvars2 = lvarstd || lrange;
const auto season_start = getSeasonStart();
......@@ -124,10 +130,8 @@ Seasstat(void *process)
const auto vdate = dtlist.getVdate(nsets);
const auto vtime = dtlist.getVtime(nsets);
cdiDecodeDate(vdate, &year, &month, &day);
const auto month = decodeMonth(vdate);
int newmon = month;
if (season_start == START_DEC && newmon == 12) newmon = 0;
const auto seas = monthToSeason(month);
......
......@@ -31,6 +31,7 @@
#include "datetime.h"
#include "printinfo.h"
void *
Yearmonstat(void *process)
{
......
......@@ -52,7 +52,7 @@ getSeasonName(const char *seas_name[])
int
monthToSeason(int month)
{
int season_start = getSeasonStart();
const auto season_start = getSeasonStart();
int seas = -1;
if (month < 0 || month > 16) cdoAbort("Month %d out of range!", month);
......
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