time_series¶
Module time_series contains ...
get_item(ens_fc_ts, i, convert_to_xr=True)
¶
Gets an item in an indexable uchronia object
Gets an item in an indexable uchronia object of one of the the C++ uchronia types identifed by TIME_SERIES_PTR, ENSEMBLE_PTR_TIME_SERIES_PTR, or ENSEMBLE_FORECAST_TIME_SERIES_PTR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ens_fc_ts |
NdTimeSeries
|
a uni- or multidimensional time series |
required |
i |
int
|
One-based index in the indexable object. |
required |
convert_to_xr |
bool
|
if True, (try to) convert to an xarray object |
True
|
Returns:
Type | Description |
---|---|
Union[ItemSliceNdTimeSeries, xr.DataArray]
|
Union["ItemSliceNdTimeSeries", xr.DataArray]: one item extracted from the series, so it has lost one dimension compared to the input. |
Example
TODO
Source code in uchronia/time_series.py
mk_date(year, month, day, hour=0, min=0, sec=0, tz='UTC')
¶
Creates a pandas Timestamp date/time object
Creates a pandas Timestamp date/time object, with a default UTC time zone and zeroes as default time arguments (i.e. midnight)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
year |
int
|
integer |
required |
month |
int
|
integer |
required |
day |
int
|
integer |
required |
hour |
int
|
integer |
0
|
min |
int
|
integer |
0
|
sec |
int
|
numeric |
0
|
tz |
str
|
character, A time zone specification to be used for the conversion. Defaults to UTC. |
'UTC'
|
Returns:
Type | Description |
---|---|
a pandas Timestamp date/time object |
Source code in uchronia/time_series.py
sub_identifiers(data_library, identifier)
¶
Gets the next level data identifier of a top level ID
Gets the next level data identifier of a top level ID. A collection of time series such as one identified by "streamflows" may have sub-identifiers such as gauge numbers. A single time series in a data library may thus be retrieved by a hierarchical string ID "streamflows.401221" 401221 is a gauge ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_library |
TimeSeriesLibrary
|
external pointer type ENSEMBLE_DATA_SET_PTR, or a Python class wrapper around it |
required |
identifier |
str
|
character, the top level identifier to test again for next level ids |
required |
Returns:
Type | Description |
---|---|
List[str]
|
List[str] sub-identifiers for a root identifier |