The cdtime module implements the CDMS time types, methods, and calendars. These are made available with the command
import cdtime
Two time types are available: relative time and component time . Relative time is time relative to a fixed base time. It consists of:
For example, the time "28.0 days since 1996-1-1" has value= 28.0 , and units= "days since 1996-1-1"
Component time consists of the integer fields year, month, day, hour, minute , and the floating-point field second . A sample component time is 1996-2-28 12:10:30.0
The cdtime module contains functions for converting between these forms, based on the common calendars used in climate simulation. Basic arithmetic and comparison operators are also available.
A calendar specifies the number of days in each month, for a given year. cdtime supports these calendars:
Several cdtime functions have an optional calendar argument. The default calendar is the MixedCalendar . The default calendar may be changed with the command:
cdtime.DefaultCalendar = newCalendar
The following table describes the methods for creating time types.
A relative time type has two members, value and units . Both can be set.
A component time type has six members, all of which are settable.
The following methods apply both to relative and component times.