data_set¶
Module data_set contains ...
as_xarray(time_series_info)
¶
Coerce an object to an xarray time series
Converts if possible an object to an xarray time series. Suitable objects are an equivalent 'uchronia' C++ entity via an external pointer. Typically deals with time series and ensemble thereof, but may be expanded later on to support more types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_series_info |
NdTimeSeries
|
A representation of a time series. Supported types are external pointers as data from uchronia C API. |
required |
Returns:
Type | Description |
---|---|
xr.DataArray
|
an xarray object |
Source code in uchronia/data_set.py
datasets_summaries(data_library)
¶
Get the summaries of datasets in a library
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_library |
TimeSeriesLibrary
|
library to query |
required |
Returns:
Type | Description |
---|---|
List[str]
|
List[str]: short descriptions of all the datasets in this library |
Source code in uchronia/data_set.py
get_data_identifiers(provider)
¶
Gets the known time series identifiers (e.g. Gauge names) of a time series provider
Gets the known time series identifiers (e.g. Gauge names) of a time series provider.
This means that the argument is a wrapper around an external pointer to a object whose type is
inheriting from the C++ type datatypes::timeseries::TimeSeriesProvider
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider |
Any
|
an external pointer to a uchronia Time Series Provider. |
required |
Returns:
Type | Description |
---|---|
List[str]
|
a character vector |
Source code in uchronia/data_set.py
get_dataset(data_library, data_id)
¶
Retrieve data from a data sets library
Gets the data from a library for a given identifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_library |
TimeSeriesLibrary
|
wrapper around an external pointer ENSEMBLE_DATA_SET_PTR, a.k.a a "time series library" |
required |
data_id |
str
|
character, one data identifier for the data retrieved. |
required |
Returns:
Name | Type | Description |
---|---|---|
NdTimeSeries |
NdTimeSeries
|
a uni- or multidimensional time series |
Source code in uchronia/data_set.py
get_dataset_ids(data_library)
¶
Gets the top level data identifiers in a data library (data set)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_library |
TimeSeriesLibrary
|
wrapper around an external pointer ENSEMBLE_DATA_SET_PTR, a.k.a a "time series library" |
required |
Returns:
Type | Description |
---|---|
List[str]
|
List[str]: identifiers for the datasets in this library |
Source code in uchronia/data_set.py
get_dataset_single_time_series(data_library, data_id)
¶
Retrieve data from a data sets library
Gets the data from a library for a given identifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_library |
TimeSeriesLibrary
|
wrapper around an external pointer ENSEMBLE_DATA_SET_PTR |
required |
data_id |
str
|
character, one data identifier for the time series. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimeSeries |
TimeSeries
|
univariate time series of dimension 1 |
Source code in uchronia/data_set.py
get_ensemble_dataset(dataset_id='', data_path='')
¶
Gets an object, a library to access a set of time series
Gets an object, a library to access a set of time series
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_id |
str
|
currently only a path to a file in YAML is supported. |
''
|
data_path |
str
|
(unused - for future use) overriding path to data storage |
''
|
Returns:
Name | Type | Description |
---|---|---|
TimeSeriesLibrary |
TimeSeriesLibrary
|
external pointer type ENSEMBLE_DATA_SET_PTR, or a Python class wrapper around it |
Example
TODO
Source code in uchronia/data_set.py
get_multiple_time_series_from_provider(ts_provider, var_ids, api_get_ts_func)
¶
Gets one or more time series from a time series provider
Gets one or more time series from a time series provider. This function is exported for use by other python packages rather than for end users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ts_provider |
Any
|
wrapper around an object coercible to a TIME_SERIES_PROVIDER_PTR |
required |
var_ids |
VecStr
|
character vector, IDs of the time series to retrieve from the provider |
required |
api_get_ts_func |
TsRetrievalSignature
|
a function that takes as arguments 'ts_provider' and a character. |
required |
Returns:
Type | Description |
---|---|
xr.DataArray
|
an xarray time series |
Example
internalGetRecordedTts <- function(simulation, varIds) {¶
uchronia::getMultipleTimeSeriesFromProvider(simulation, varIds, GetRecorded_Pkg_R)¶
}¶
Source code in uchronia/data_set.py
get_time_series_from_provider(provider, data_id=None)
¶
Gets a time series from a time series provider, given a data ID
Gets a time series from a time series provider, given a data ID.
This means that the argument is a wrapper around an external pointer to a object whose type is
inheriting from the C++ type datatypes::timeseries::TimeSeriesProvider
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider |
Any
|
an external pointer to a uchronia Time Series Provider. |
required |
data_id |
str
|
character, one or more data identifier for the time series. If missing, all known identifiers will be used; be careful about the resulting size. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
an xarray time series, or several, or None? |