TimeManager
This module contains functions that handle dates and times in simulations. The functions in this module often call functions from Julia's Dates module.
TimeManager API
ClimaCoupler.TimeManager.current_date
— Functioncurrent_date(cs::Interfacer.CoupledSimulation, t::Int)
Return the model date at the current timestep.
Arguments
cs
: [CoupledSimulation] containing info about the simulationt
: [Real] number of seconds since simulation began
ClimaCoupler.TimeManager.strdate_to_datetime
— Functionstrdate_to_datetime(strdate::String)
Convert from String ("YYYYMMDD") to Date format, required by the official AMIP input files.
Arguments
strdate
: [String] to be converted to Date type
ClimaCoupler.TimeManager.datetime_to_strdate
— Functiondatetime_to_strdate(datetime::DateTime)
Convert from Date to String ("YYYYMMDD") format.
Arguments
datetime
: [Dates.DateTime] object to be converted to string
ClimaCoupler.TimeManager.trigger_callback
— Functiontrigger_callback(cs, ::Monthly)
Returns true
if the current date is equal to or exceeds the saved first of the month at time of 00:00:00.
Arguments
cs
: [CoupledSimulation] containing info about the simulation
ClimaCoupler.TimeManager.AbstractFrequency
— TypeAbstractFrequency
This is an abstract type for the frequency of the callback function.
ClimaCoupler.TimeManager.Monthly
— TypeMonthly
A concrete type for the monthly frequency of the callback function.
ClimaCoupler.TimeManager.EveryTimestep
— TypeEveryTimestep
A concrete type for the every-timestep frequency of the callback function.
ClimaCoupler.TimeManager.trigger_callback!
— Functiontrigger_callback!(cs::Interfacer.CoupledSimulation, cb::CouplerCallback)
This function triggers a callback function if the current date is equal to or exceeds the saved callback reference date. As well as executing the functions func
, it automatically updates the reference date, ref_date
, for the next callback interval.
ClimaCoupler.TimeManager.CouplerCallback
— TypeCouplerCallback
This is an abstract type for ClimaCoupler's callback functions.
ClimaCoupler.TimeManager.HourlyCallback
— TypeHourlyCallback{FT}
This is a callback type that triggers at intervals of 1h or multiple hours.
Fields
dt
func
ref_date
active
- `data
ClimaCoupler.TimeManager.MonthlyCallback
— TypeMonthlyCallback{FT}
This is a callback type that triggers at intervals of 1 month or multiple months.
Fields
dt
func
ref_date
active
data
ClimaCoupler.TimeManager.update_firstdayofmonth!
— Functionupdate_firstdayofmonth!(cs::Interfacer.CoupledSimulation, _)
This function updates the first of the month reference date.
ClimaCoupler.TimeManager.dt_cb
— Functiondt_cb(cb::HourlyCallback)
dt_cb(cb::MonthlyCallback)
This function returns the time interval for the callback function.
ClimaCoupler.TimeManager.do_nothing
— Functiondo_nothing(::Interfacer.CoupledSimulation, _)
This is a helper callback function that does nothing.