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
ClimaUtilities.TimeManager.to_datetime
— Functionto_datetime(date)
Convert a DateTime
-like object (e.g. DateTimeNoLeap
) to a DateTime
. We need this since some data files we use contain DateTimeNoLeap
objects for dates, which can't be used for math with DateTime
s. The DateTimeNoLeap
type uses the Gregorian calendar without leap years, while the DateTime
type uses Gregorian calendar with leap years.
For consistency, all input data files should have dates converted to DateTime
before being used in a simulation.
This function is similar to reinterpret
in CFTime.jl.
Arguments
date
:DateTime
-like object to be converted toDateTime
ClimaUtilities.TimeManager.strdate_to_datetime
— Functionstrdate_to_datetime(strdate::String)
Convert from String ("YYYYMMDD") to Date format, required by the official AMIP input files.
ClimaUtilities.TimeManager.datetime_to_strdate
— Functiondatetime_to_strdate(datetime::Dates.DateTime)
Convert from DateTime to String ("YYYYMMDD") format.
ClimaUtilities.TimeManager.trigger_callback
— Functiontrigger_callback(date_nextcall::Dates.DateTime,
date_current::Dates.DateTime,
::Monthly,
func::Function,)
If the current date is equal to or later than the "next call" date at time 00:00:00, call the callback function and increment the next call date by one month. Otherwise, do nothing and leave the next call date unchanged.
The tuple of arguments func_args
must match the types, number, and order of arguments expected by func
.
Arguments
date_nextcall::DateTime
the next date to call the callback function at or afterdate_current::DateTime
the current date of the simulationsave_freq::AbstractFrequency
frequency with which to trigger callbackfunc::Function
function to be triggered if date is at or past the next call datefunc_args::Tuple
a tuple of arguments to be passed into the callback function
Missing docstring for ClimaUtilities.TimeManager.Monthly
. Check Documenter's build log for details.
Missing docstring for ClimaUtilities.TimeManager.EveryTimestep
. Check Documenter's build log for details.