tsdat.io.retrievers

Classes

DefaultRetriever

Reads data from one or more inputs, renames coordinates and data variables according

class tsdat.io.retrievers.DefaultRetriever[source]

Bases: tsdat.io.base.Retriever

Reads data from one or more inputs, renames coordinates and data variables according to retrieval and dataset configurations, and applies registered DataConverters to retrieved data.

Parameters
  • readers (Dict[Pattern[str], DataReader]) – A mapping of patterns to DataReaders

  • the retriever uses to determine which DataReader to use for reading any (that) –

  • input key. (given) –

  • coords (Dict[str, Dict[Pattern[str], VariableRetriever]]) – A dictionary mapping

  • coordinate variable names to rules for how they should be retrieved. (output) –

  • data_vars (Dict[str, Dict[Pattern[str], VariableRetriever]]) – A dictionary

  • output data variable names to rules for how they should be retrieved. (mapping) –

class Parameters[source]

Bases: pydantic.BaseModel

merge_kwargs :Dict[str, Any][source]

Keyword arguments passed to xr.merge(). This is only relevant if multiple input keys are provided simultaneously, or if any registered DataReader objects could return a dataset mapping instead of a single dataset.

coords :Dict[str, Dict[Pattern, VariableRetriever]][source]

A dictionary mapping output coordinate names to the retrieval rules and preprocessing actions (e.g., DataConverters) that should be applied to each retrieved coordinate variable.

data_vars :Dict[str, Dict[Pattern, VariableRetriever]][source]

A dictionary mapping output data variable names to the retrieval rules and preprocessing actions (e.g., DataConverters) that should be applied to each retrieved data variable.

parameters :DefaultRetriever.Parameters[source]
readers :Dict[Pattern, tsdat.io.base.DataReader][source]

A dictionary of DataReaders that should be used to read data provided an input key.

Class Methods

retrieve

Prepares the raw dataset mapping for use in downstream pipeline processes by

Method Descriptions

retrieve(self, input_keys: List[str], dataset_config: tsdat.config.dataset.DatasetConfig, **kwargs: Any)xarray.Dataset[source]

Prepares the raw dataset mapping for use in downstream pipeline processes by consolidating the data into a single xr.Dataset object. The retrieved dataset may contain additional coords and data_vars that are not defined in the output dataset. Input data converters are applied as part of the preparation process.

Parameters
  • input_keys (List[str]) – The input keys the registered DataReaders should

  • from. (read) –

  • dataset_config (DatasetConfig) – The specification of the output dataset.

Returns

The retrieved dataset.

Return type

xr.Dataset