TimeDomain
- class unifhy.TimeDomain(timestamps, units, calendar=None)
TimeDomain characterises a temporal dimension that is needed by a
Component
.Instantiation
- Parameters
- timestamps: one-dimensional array-like object
The array of timestamps defining the temporal dimension. May be any type that can be cast to a
numpy.ndarray
. Must contain numerical values.Note: the first timestamp of the array is the beginning of the first timestep, and the last timestamp is the end of the last timestep (not its start).
Parameter example:
timestamps=[0, 1, 2, 3]
Parameter example:
timestamps=(5, 7, 9)
Parameter example:
timestamps=numpy.arange(0, 10, 3)
- units:
str
Reference in time for the timestamps following the format ‘unit_of_time since reference_datetime’.
Parameter example:
units='seconds since 1970-01-01'
Parameter example:
units='days since 2000-01-01 09:00:00'
- calendar:
str
, optional Calendar to be used for the reference in time of units. If not provided, set to default value ‘gregorian’.
Parameter example:
calendar='all_leap'
Parameter example:
calendar='365_day'
Examples
>>> td = TimeDomain(timestamps=[0, 1, 2, 3], ... units='seconds since 1970-01-01 00:00:00', ... calendar='standard') >>> print(td) TimeDomain( time (3,): [1970-01-01 00:00:00, 1970-01-01 00:00:01, 1970-01-01 00:00:02] standard bounds (3, 2): [[1970-01-01 00:00:00, ..., 1970-01-01 00:00:03]] standard calendar: standard units: seconds since 1970-01-01 00:00:00 period: 0:00:03 timedelta: 0:00:01 )
Methods
Construction
Instantiate a |
|
Instantiate a |
|
Instantiate a |
Comparison
Compare equality between the TimeDomain and the 'time' dimension coordinate in a |
|
Compare equality in period spanned between the TimeDomain and another instance of TimeDomain. |
Attributes
Return the time series of the TimeDomain instance as a |
|
Return the bounds of the time series of the TimeDomain instance as a |
|
Return the units of the time series of the TimeDomain instance as a |
|
Return the calendar of the time series of the TimeDomain instance as a |
|
Return the period that the TimeDomain is covering as a |
|
Return the time duration separating time steps in the time series of the TimeDomain instance as a |