A wrapper around time coordinates in Meridian's input data.
meridian
.
data
.
time_coordinates
.
TimeCoordinates
(
datetime_index
:
pd
.
DatetimeIndex
)
Meridian models store time coordinates as untyped strings. It treats them as labels, and they have no intrinsic meaning to the model other than the assumption that they represent some linearly increasing time coordinates.
This wrapper object performs some additional validation and methods for extracting values out of these time coordinates which are treated as numeric "date" values.
Attributes
Methods
expand_selected_time_dims
expand_selected_time_dims
(
start_date
:
meridian
.
data
.
time_coordinates
.
Date
=
None
,
end_date
:
meridian
.
data
.
time_coordinates
.
Date
=
None
)
->
(
list
[
datetime
.
date
]
|
None
)
Validates and returns time dimension values based on the selected times.
If both start_date
and end_date
are None, returns None. If specified,
both start_date
and end_date
are inclusive, and must be present in the
time coordinates of the input data.
start_date
None
, implies the
earliest time dimension value in the input data.end_date
None
, implies the
latest time dimension value in the input data.
datetime.date
objects) in the input
data within the selected time period, or do nothing and pass through None
if both arguments are None
, or if start_date
and end_date
correspond to the entire time range in the input data.
ValueError
if start_date
or end_date
is not in the input data's time
dimension coordinates. from_dates
@classmethodfrom_dates ( dates : _TimeCoordinateValues ) -> 'TimeCoordinates'
Creates a TimeCoordinates
from a polymorphic series of dates.
dates
DatetimeIndex
or an Xarray DataArray
with "YYYY-mm-dd" string
labels.
TimeCoordinates
dataclass. get_selected_dates
get_selected_dates
(
selected_interval
:
(
meridian
.
data
.
time_coordinates
.
DateInterval
|
None
)
=
None
)
->
list
[
datetime
.
date
]
Creates a sequence of dates containing all points in selected interval.
selected_interval
DateInterval
proto. If None
, then all_dates
is returned.
all_dates
between the
given start and end dates, as Python's builtin datetime.date
objects.
ValueError
selected_interval
is not a subset of all_dates
. __eq__
__eq__
(
other
)
Return self==value.



