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

Renamed set_date() to setDateTime().

parent f28facc7
......@@ -34,14 +34,6 @@
#include "percentiles.h"
struct date_time_t
{
int64_t date;
int time;
};
void set_date(int64_t date, int time, date_time_t *datetime);
void *
Yseaspctl(void *process)
{
......@@ -52,7 +44,7 @@ Yseaspctl(void *process)
int levelID;
size_t nmiss;
long nsets[MaxSeasons];
date_time_t datetime1[MaxSeasons], datetime2[MaxSeasons];
CdoDateTime datetime1[MaxSeasons], datetime2[MaxSeasons];
FieldVector2D vars1[MaxSeasons];
HistogramSet hsets[MaxSeasons];
......@@ -122,7 +114,7 @@ Yseaspctl(void *process)
const auto seas = monthToSeason(decodeMonth(vdate));
set_date(vdate, vtime, &datetime2[seas]);
setDateTime(datetime2[seas], vdate, vtime);
if (!vars1[seas].size())
{
......@@ -168,7 +160,7 @@ Yseaspctl(void *process)
const auto seas = monthToSeason(month);
set_date(vdate, vtime, &datetime1[seas]);
setDateTime(datetime1[seas], vdate, vtime);
if (!vars1[seas].size()) cdoAbort("No data for season %d in %s and %s", seas, cdoGetStreamName(1), cdoGetStreamName(2));
......
......@@ -38,26 +38,6 @@
#include "process_int.h"
struct date_time_t
{
int64_t date;
int time;
};
void
set_date(int64_t date, int time, date_time_t *datetime)
{
int year, month, day;
cdiDecodeDate(date, &year, &month, &day);
if (month == 12) date = cdiEncodeDate(year - 1, month, day);
if (date > datetime->date)
{
datetime->date = date;
datetime->time = time;
}
}
static void
addOperators(void)
{
......@@ -79,10 +59,9 @@ void *
Yseasstat(void *process)
{
constexpr int MaxSeasons = 4;
int year, month, day;
int nrecs;
int seas_nsets[MaxSeasons];
date_time_t datetime[MaxSeasons];
CdoDateTime datetime[MaxSeasons];
FieldVector2D vars1[MaxSeasons], vars2[MaxSeasons], samp1[MaxSeasons];
cdoInitialize(process);
......@@ -92,14 +71,12 @@ Yseasstat(void *process)
const auto operatorID = cdoOperatorID();
const auto operfunc = cdoOperatorF1(operatorID);
// clang-format off
const bool lrange = operfunc == func_range;
const bool lmean = operfunc == func_mean || operfunc == func_avg;
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;
const bool lvars2 = lvarstd || lrange;
// clang-format on
for (int seas = 0; seas < MaxSeasons; seas++)
{
......@@ -135,11 +112,10 @@ Yseasstat(void *process)
{
const auto vdate = taxisInqVdate(taxisID1);
const auto vtime = taxisInqVtime(taxisID1);
cdiDecodeDate(vdate, &year, &month, &day);
const auto seas = monthToSeason(month);
const auto seas = monthToSeason(decodeMonth(vdate));
set_date(vdate, vtime, &datetime[seas]);
setDateTime(datetime[seas], vdate, vtime);
if (!vars1[seas].size())
{
......
......@@ -487,3 +487,17 @@ decodeHourOfDay(int64_t date, int time)
return hourod;
}
void
setDateTime(CdoDateTime &datetime, int64_t date, int time)
{
int year, month, day;
cdiDecodeDate(date, &year, &month, &day);
if (month == 12) date = cdiEncodeDate(year - 1, month, day);
if (date > datetime.date)
{
datetime.date = date;
datetime.time = time;
}
}
......@@ -145,4 +145,6 @@ int decodeDayOfYear(int64_t date);
int decodeHourOfYear(int64_t date, int time);
int decodeHourOfDay(int64_t date, int time);
void setDateTime(CdoDateTime &datetime, int64_t date, int time);
#endif /* DATETIME_H */
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