|
TECA
The Toolkit for Extreme Climate Analysis
|
Go to the documentation of this file. 1 #ifndef teca_calendar_h
2 #define teca_calendar_h
6 #include "teca_config.h"
8 #include "teca_metadata.h"
79 time_point() : index(-1), time(0.0), year(0), month(1), day(1),
80 hour(0), minute(0), second(0.0)
93 time_point(
long i,
double t,
int YYYY=0,
int MM=1,
int DD=1,
94 int hh=0,
int mm=0,
double ss=0.0) : index(i), time(t),
95 year(YYYY), month(MM), day(DD), hour(hh), minute(mm),
108 const std::string &units,
const std::string &calendar);
126 begin(), end(), valid(
false)
145 long first_step,
long last_step);
156 const std::string &units,
const std::string &calendar,
157 long first_step,
long last_step) = 0;
160 virtual bool is_valid()
const = 0;
167 virtual int get_next_interval(
time_point &first_step,
171 operator bool()
const
173 return this->is_valid();
185 std::string calendar;
206 bool is_valid()
const override;
218 const std::string &units,
const std::string &calendar,
219 long first_step,
long last_step)
override;
234 int get_first_season(
int y_in,
int m_in,
int &y_out,
int &m_out)
const;
239 int get_season_end(
int y_in,
int m_in,
240 int &y_out,
int &m_out,
int &d_out)
const;
245 int get_next_season(
int y_in,
int m_in,
int &y_out,
int &m_out)
const;
263 bool is_valid()
const override;
275 const std::string &units,
const std::string &calendar,
276 long first_step,
long last_step)
override;
301 bool is_valid()
const override;
313 const std::string &units,
const std::string &calendar,
314 long first_step,
long last_step)
override;
340 bool is_valid()
const override;
352 const std::string &units,
const std::string &calendar,
353 long first_step,
long last_step)
override;
370 using p_interval_iterator = std::shared_ptr<interval_iterator>;
381 static p_interval_iterator New(
const std::string &interval);
384 enum {invalid = 0, daily = 2, monthly = 3, seasonal = 4, yearly = 5};
391 static p_interval_iterator New(
int interval);
const time_point & get_end() const
return the last time point in the series
Definition: teca_calendar_util.h:180
time_point(long i, double t, int YYYY=0, int MM=1, int DD=1, int hh=0, int mm=0, double ss=0.0)
Definition: teca_calendar_util.h:93
TECA_EXPORT std::ostream & operator<<(std::ostream &os, const teca_calendar_util::time_point &tpt)
send the time_point to a stream in humnan readable form
Enumerate ranges of time steps bracketing days.
Definition: teca_calendar_util.h:334
Codes dealing with calendaring.
Definition: teca_calendar_util.h:16
TECA_EXPORT bool valid_gregorian_date(long y, long m, long d)
TECA_EXPORT long gregorian_number(long y, long m, long d)
const time_point & get_begin() const
return the first time point in the series
Definition: teca_calendar_util.h:177
An iterator over a series of time intervals.
Definition: teca_calendar_util.h:121
Enumerate ranges of time steps bracketing months.
Definition: teca_calendar_util.h:295
TECA_EXPORT void date_from_gregorian_number(long g, long &y, long &m, long &d)
std::shared_ptr< const teca_variant_array > const_p_teca_variant_array
Definition: teca_variant_array.h:27
A factory for interval_iterator.
Definition: teca_calendar_util.h:373
virtual int initialize(const teca_metadata &md)
Enumerate ranges of time steps bracketing months.
Definition: teca_calendar_util.h:257
Definition: teca_calendar_util.h:77
const TECA_EXPORT char * get_season_name(int month)
returns one of DJF,MAM,JJA,SON based on the month passed in
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.
Enumerate ranges of time steps bracketing seasons.
Definition: teca_calendar_util.h:200