|
TECA
The Toolkit for Extreme Climate Analysis
|
Go to the documentation of this file. 1 #ifndef teca_calendar_h
2 #define teca_calendar_h
7 #include "teca_metadata.h"
74 time_point() : index(-1), time(0.0), year(0), month(1), day(1),
75 hour(0), minute(0), second(0.0)
88 time_point(
long i,
double t,
int YYYY=0,
int MM=1,
int DD=1,
89 int hh=0,
int mm=0,
double ss=0.0) : index(i), time(t),
90 year(YYYY), month(MM), day(DD), hour(hh), minute(mm),
103 const std::string &units,
const std::string &calendar);
121 begin(), end(), valid(
false)
140 long first_step,
long last_step);
151 const std::string &units,
const std::string &calendar,
152 long first_step,
long last_step) = 0;
166 operator bool()
const
180 std::string calendar;
213 const std::string &units,
const std::string &calendar,
214 long first_step,
long last_step)
override;
227 int get_first_season(
int y_in,
int m_in,
int &y_out,
int &m_out)
const;
232 int get_season_end(
int y_in,
int m_in,
233 int &y_out,
int &m_out,
int &d_out)
const;
238 int get_next_season(
int y_in,
int m_in,
int &y_out,
int &m_out)
const;
268 const std::string &units,
const std::string &calendar,
269 long first_step,
long last_step)
override;
304 const std::string &units,
const std::string &calendar,
305 long first_step,
long last_step)
override;
341 const std::string &units,
const std::string &calendar,
342 long first_step,
long last_step)
override;
357 using p_interval_iterator = std::shared_ptr<interval_iterator>;
368 static p_interval_iterator
New(
const std::string &interval);
371 enum {invalid = 0, daily = 2, monthly = 3, seasonal = 4, yearly = 5};
378 static p_interval_iterator
New(
int interval);
void date_from_gregorian_number(long g, long &y, long &m, long &d)
bool valid_gregorian_date(long y, long m, long d)
int initialize(const const_p_teca_variant_array &t, const std::string &units, const std::string &calendar, long first_step, long last_step) override
const time_point & get_end() const
return the last time point in the series
Definition: teca_calendar_util.h:175
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:88
int get_next_interval(time_point &first_step, time_point &last_step) override
int get_next_interval(time_point &first_step, time_point &last_step) override
Enumerate ranges of time steps bracketing days.
Definition: teca_calendar_util.h:323
virtual int get_next_interval(time_point &first_step, time_point &last_step)=0
bool is_valid() const override
return true if there are more time steps in the sequence
Codes dealing with calendaring.
Definition: teca_calendar_util.h:15
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:172
An iterator over a series of time intervals.
Definition: teca_calendar_util.h:116
virtual bool is_valid() const =0
return true if there are more time steps in the sequence
Enumerate ranges of time steps bracketing months.
Definition: teca_calendar_util.h:286
int initialize(const const_p_teca_variant_array &t, const std::string &units, const std::string &calendar, long first_step, long last_step) override
std::shared_ptr< const teca_variant_array > const_p_teca_variant_array
Definition: teca_variant_array.h:22
bool is_valid() const override
return true if there are more time steps in the sequence
bool is_valid() const override
return true if there are more time steps in the sequence
bool is_valid() const override
return true if there are more time steps in the sequence
A factory for interval_iterator.
Definition: teca_calendar_util.h:360
virtual int initialize(const teca_metadata &md)
Enumerate ranges of time steps bracketing months.
Definition: teca_calendar_util.h:250
int get_next_interval(time_point &first_step, time_point &last_step) override
Definition: teca_calendar_util.h:72
int get_next_interval(time_point &first_step, time_point &last_step) override
int initialize(const const_p_teca_variant_array &t, const std::string &units, const std::string &calendar, long first_step, long last_step) override
int initialize(const const_p_teca_variant_array &t, const std::string &units, const std::string &calendar, long first_step, long last_step) override
static p_interval_iterator New(const std::string &interval)
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 seasons.
Definition: teca_calendar_util.h:195
const char * get_season_name(int month)
returns one of DJF,MAM,JJA,SON based on the month passed in