26#include "pism/util/pism_utilities.hh"
27#include "pism/util/Units.hh"
28#include "pism/util/Config.hh"
38 return set_member(name, {
"standard",
"gregorian",
"proleptic_gregorian",
39 "noleap",
"365_day",
"julian",
"360_day"});
58 Time(MPI_Comm com, std::shared_ptr<const Config> config,
66 void set(
double new_time);
73 void step(
double delta_t);
88 std::vector<double>
parse_times(
const std::string &spec)
const;
120 std::string
date(
double T)
const;
127 std::vector<double>
parse_list(
const std::string &spec)
const;
128 std::vector<double>
parse_range(
const std::string &spec)
const;
131 std::vector<double> &result)
const;
142 std::vector<double> &result)
const;
182 bool set_start_time);
190 double forcing_start,
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.
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...
std::shared_ptr< const Config > m_config
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.
std::string m_variable_name
void compute_times(double time_start, double time_end, const Interval &interval, std::vector< double > &result) const
VariableMetadata metadata(bool with_bounds=false) const
Metadata of the NetCDF variable for writing to an output file.
std::vector< double > parse_range(const std::string &spec) const
VariableMetadata bounds_metadata() const
Metadata of the NetCDF variable containing time bounds.
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.
units::Unit units() const
std::vector< double > parse_times(const std::string &spec) const
std::string variable_name() const
Name of the NetCDF variable to use.
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 pism_is_valid_calendar_name(const std::string &name)
bool set_member(const std::string &string, const std::set< std::string > &set)