Commit 24ae64ad authored by Uwe Schulzweida's avatar Uwe Schulzweida

Added option --ignore_time_bounds to ignore time bounds for time range statistics.

parent 4edd4bb7
Pipeline #5628 passed with stages
in 14 minutes and 53 seconds
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
2021-01-05 Uwe Schulzweida 2021-01-05 Uwe Schulzweida
* Added option --ignore_time_bounds to ignore time bounds for time range statistics
* Isosurface: Added memory support for 32-bit float data. * Isosurface: Added memory support for 32-bit float data.
2020-12-17 Uwe Schulzweida 2020-12-17 Uwe Schulzweida
......
...@@ -267,6 +267,7 @@ cdo_usage() ...@@ -267,6 +267,7 @@ cdo_usage()
fprintf(stderr, fprintf(stderr,
" F<XXX>, t<RES>, tl<RES>, global_<DXY>, r<NX>x<NY>, g<NX>x<NY>, gme<NI>, lon=<LON>/lat=<LAT>\n"); " F<XXX>, t<RES>, tl<RES>, global_<DXY>, r<NX>x<NY>, g<NX>x<NY>, gme<NI>, lon=<LON>/lat=<LAT>\n");
fprintf(stderr, " -h, --help Help information for the operators\n"); fprintf(stderr, " -h, --help Help information for the operators\n");
fprintf(stderr, " --ignore_time_bounds Ignores time bounds for time range statistics\n");
fprintf(stderr, " --no_history Do not append to NetCDF \"history\" global attribute\n"); fprintf(stderr, " --no_history Do not append to NetCDF \"history\" global attribute\n");
fprintf(stderr, " --netcdf_hdr_pad, --hdr_pad, --header_pad <nbr>\n"); fprintf(stderr, " --netcdf_hdr_pad, --hdr_pad, --header_pad <nbr>\n");
fprintf(stderr, " Pad NetCDF output header with nbr bytes\n"); fprintf(stderr, " Pad NetCDF output header with nbr bytes\n");
...@@ -999,6 +1000,7 @@ parseOptionsLong(int argc, char *argv[]) ...@@ -999,6 +1000,7 @@ parseOptionsLong(int argc, char *argv[])
int leccodes; int leccodes;
int lenableexcept; int lenableexcept;
int lgridsearchradius; int lgridsearchradius;
int lignore_time_bounds;
int lnetcdf_hdr_pad; int lnetcdf_hdr_pad;
int lno_remap_weights; int lno_remap_weights;
int lpercentile; int lpercentile;
...@@ -1031,6 +1033,7 @@ parseOptionsLong(int argc, char *argv[]) ...@@ -1031,6 +1033,7 @@ parseOptionsLong(int argc, char *argv[])
{ "enableexcept" , required_argument , &lenableexcept , 1 }, { "enableexcept" , required_argument , &lenableexcept , 1 },
{ "timestat_date" , required_argument , &ltimestat_date , 1 }, { "timestat_date" , required_argument , &ltimestat_date , 1 },
{ "no_remap_weights" , no_argument , &lno_remap_weights , 1 }, { "no_remap_weights" , no_argument , &lno_remap_weights , 1 },
{ "ignore_time_bounds" , no_argument , &lignore_time_bounds , 1 },
{ "use_time_bounds" , no_argument , &luse_time_bounds , 1 }, { "use_time_bounds" , no_argument , &luse_time_bounds , 1 },
{ "cmor" , no_argument , &Options::CMOR_Mode , 1 }, { "cmor" , no_argument , &Options::CMOR_Mode , 1 },
{ "reduce_dim" , no_argument , &Options::CDO_Reduce_Dim , 1 }, { "reduce_dim" , no_argument , &Options::CDO_Reduce_Dim , 1 },
...@@ -1093,6 +1096,7 @@ parseOptionsLong(int argc, char *argv[]) ...@@ -1093,6 +1096,7 @@ parseOptionsLong(int argc, char *argv[])
lsortparam = 0; lsortparam = 0;
ltimestat_date = 0; ltimestat_date = 0;
luse_fftw = 0; luse_fftw = 0;
lignore_time_bounds = 0;
luse_time_bounds = 0; luse_time_bounds = 0;
int c = cdo_getopt_long(argc, argv, "f:b:e:P:g:i:k:l:m:n:t:D:z:aC:AcdhLMOpQRrsSTuVvWwXZ", opt_long, nullptr); int c = cdo_getopt_long(argc, argv, "f:b:e:P:g:i:k:l:m:n:t:D:z:aC:AcdhLMOpQRrsSTuVvWwXZ", opt_long, nullptr);
...@@ -1153,6 +1157,11 @@ parseOptionsLong(int argc, char *argv[]) ...@@ -1153,6 +1157,11 @@ parseOptionsLong(int argc, char *argv[])
{ {
setTimestatDate(CDO_optarg); setTimestatDate(CDO_optarg);
} }
else if (lignore_time_bounds)
{
extern bool CDO_Ignore_Time_Bounds;
CDO_Ignore_Time_Bounds = true;
}
else if (luse_time_bounds) else if (luse_time_bounds)
{ {
extern bool CDO_Use_Time_Bounds; extern bool CDO_Use_Time_Bounds;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "util_string.h" #include "util_string.h"
TimeStat CDO_Timestat_Date = TimeStat::UNDEF; TimeStat CDO_Timestat_Date = TimeStat::UNDEF;
bool CDO_Ignore_Time_Bounds = false;
bool CDO_Use_Time_Bounds = false; bool CDO_Use_Time_Bounds = false;
static bool dateTimeInit = false; static bool dateTimeInit = false;
...@@ -119,16 +120,8 @@ DateTimeList::taxisInqTimestep(const int taxisID, const int tsID) ...@@ -119,16 +120,8 @@ DateTimeList::taxisInqTimestep(const int taxisID, const int tsID)
if (tsID == 0) if (tsID == 0)
{ {
if (this->has_bounds == -1) if (this->has_bounds == -1) this->has_bounds = CDO_Ignore_Time_Bounds ? 0 : taxisHasBounds(taxisID);
{ if (this->calendar == -1) this->calendar = taxisInqCalendar(taxisID);
this->has_bounds = 0;
if (taxisHasBounds(taxisID)) this->has_bounds = 1;
}
if (this->calendar == -1)
{
this->calendar = taxisInqCalendar(taxisID);
}
} }
if (this->has_bounds) if (this->has_bounds)
......
...@@ -86,19 +86,10 @@ DateTimeList ...@@ -86,19 +86,10 @@ DateTimeList
{ {
public: public:
DateTimeList() { init(); } DateTimeList() { init(); }
// clang-format off
void void setStat(const TimeStat _stat) { this->stat = _stat; }
setStat(const TimeStat _stat) void setCalendar(const int _calendar) { this->calendar = _calendar; }
{ // clang-format on
this->stat = _stat;
}
void
setCalendar(const int _calendar)
{
this->calendar = _calendar;
}
int64_t getVdate(int tsID); int64_t getVdate(int tsID);
int getVtime(int tsID); int getVtime(int tsID);
void shift(); void shift();
......
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