25 #include "pism/util/pism_utilities.hh"
26 #include "pism/util/Units.hh"
27 #include "pism/util/ConfigInterface.hh"
37 return member(name, {
"standard",
"gregorian",
"proleptic_gregorian",
38 "noleap",
"365_day",
"julian",
"360_day"});
62 typedef std::shared_ptr<Time>
Ptr;
66 void set(
double new_time);
73 void step(
double delta_t);
90 std::vector<double>
parse_times(
const std::string &spec)
const;
116 std::string
date(
double T)
const;
123 std::vector<double>
parse_list(
const std::string &spec)
const;
124 std::vector<double>
parse_range(
const std::string &spec)
const;
127 std::vector<double> &result)
const;
138 std::vector<double> &result)
const;
176 bool set_start_time);
184 double forcing_start,
std::shared_ptr< const Config > ConstPtr
double increment_date(double T, double years) const
std::vector< double > parse_list(const std::string &spec) const
std::string run_length() const
Returns the length of the current run, in years.
std::shared_ptr< const Time > ConstPtr
const Config::ConstPtr m_config
std::string units_string() const
Internal time units as a string.
void compute_times_monthly(std::vector< double > &result) const
double years_to_seconds(double input) const
void set(double new_time)
Sets the current time (in seconds since the reference time).
double convert_time_interval(double T, const std::string &units) const
Convert time interval from seconds to given units. Handle 'years' using the year length corresponding...
double m_year_length
number of seconds in a year, for "year fraction"
void set_end(double new_end)
void compute_times_simple(double time_start, double delta, double time_end, std::vector< double > &result) const
void init_calendar(const std::string &calendar)
double calendar_year_start(double T) const
Returns the model time in seconds corresponding to the beginning of the year T falls into.
void compute_times(double time_start, double time_end, const Interval &interval, std::vector< double > &result) const
std::vector< double > parse_range(const std::string &spec) const
double m_run_end
run end tim, in seconds since the reference time
double year_fraction(double T) const
Returns the fraction of a year that passed since the last beginning of a year. Only useful in codes w...
double m_time_in_seconds
current time, in seconds since the reference time
Interval parse_interval_length(const std::string &spec) const
std::string m_calendar_string
CF calendar string.
double seconds_to_years(double input) const
double current() const
Current time, in seconds.
std::shared_ptr< Time > Ptr
units::Unit units() const
std::vector< double > parse_times(const std::string &spec) const
Time(MPI_Comm com, Config::ConstPtr config, const Logger &log, units::System::Ptr unit_system)
void compute_times_yearly(std::vector< double > &result) const
double day_of_the_year_to_year_fraction(unsigned int day) const
Convert the day number to the year fraction.
void step(double delta_t)
Advance by delta_t seconds.
void set_start(double new_start)
std::string date(double T) const
Returns the date corresponding to time T.
double m_run_start
run start time, in seconds since the reference time
const units::System::Ptr m_unit_system
std::string calendar() const
Returns the calendar string.
void init_from_file(MPI_Comm com, const std::string &filename, const Logger &log, bool set_start_time)
Sets the time from a NetCDF file with a time dimension (-time_file).
double m_t_eps
Time resolution, in seconds.
std::shared_ptr< System > Ptr
void check_forcing_duration(const Time &time, double forcing_start, double forcing_end)
bool member(const std::string &string, const std::set< std::string > &set)
bool pism_is_valid_calendar_name(const std::string &name)