tsdat.io.readers
¶
Classes¶
Uses pandas and xarray functions to read a csv file and extract its contents into an |
|
Thin wrapper around xarray's open_dataset() function, with optional parameters |
|
Uses pandas and xarray functions to read a parquet file and extract its contents |
|
Uses xarray's Zarr capabilities to read a Zarr archive and extract its contents into |
- class tsdat.io.readers.CSVReader[source]¶
Bases:
tsdat.io.base.DataReader
Uses pandas and xarray functions to read a csv file and extract its contents into an xarray Dataset object. Two parameters are supported: read_csv_kwargs and from_dataframe_kwargs, whose contents are passed as keyword arguments to pandas.read_csv() and xarray.Dataset.from_dataframe() respectively.
Class Methods
Reads data given an input key.
Method Descriptions
- read(self, input_key: str) xarray.Dataset [source]¶
Reads data given an input key.
Uses the input key to open a resource and load data as a xr.Dataset object or as a mapping of strings to xr.Dataset objects.
In most cases DataReaders will only need to return a single xr.Dataset, but occasionally some types of inputs necessitate that the data loaded from the input_key be returned as a mapping. For example, if the input_key is a path to a zip file containing multiple disparate datasets, then returning a mapping is appropriate.
- Parameters
input_key (str) – An input key matching the DataReader’s regex pattern that should be used to load data.
- Returns
Union[xr.Dataset, Dict[str, xr.Dataset]] –
- The raw data extracted from the
provided input key.
- class tsdat.io.readers.NetCDFReader[source]¶
Bases:
tsdat.io.base.DataReader
Thin wrapper around xarray’s open_dataset() function, with optional parameters used as keyword arguments in the function call.
Class Methods
Reads data given an input key.
Method Descriptions
- read(self, input_key: str) xarray.Dataset [source]¶
Reads data given an input key.
Uses the input key to open a resource and load data as a xr.Dataset object or as a mapping of strings to xr.Dataset objects.
In most cases DataReaders will only need to return a single xr.Dataset, but occasionally some types of inputs necessitate that the data loaded from the input_key be returned as a mapping. For example, if the input_key is a path to a zip file containing multiple disparate datasets, then returning a mapping is appropriate.
- Parameters
input_key (str) – An input key matching the DataReader’s regex pattern that should be used to load data.
- Returns
Union[xr.Dataset, Dict[str, xr.Dataset]] –
- The raw data extracted from the
provided input key.
- class tsdat.io.readers.ParquetReader[source]¶
Bases:
tsdat.io.base.DataReader
Uses pandas and xarray functions to read a parquet file and extract its contents into an xarray Dataset object. Two parameters are supported: read_parquet_kwargs and from_dataframe_kwargs, whose contents are passed as keyword arguments to pandas.read_parquet() and xarray.Dataset.from_dataframe() respectively.
Class Methods
Reads data given an input key.
Method Descriptions
- read(self, input_key: str) xarray.Dataset [source]¶
Reads data given an input key.
Uses the input key to open a resource and load data as a xr.Dataset object or as a mapping of strings to xr.Dataset objects.
In most cases DataReaders will only need to return a single xr.Dataset, but occasionally some types of inputs necessitate that the data loaded from the input_key be returned as a mapping. For example, if the input_key is a path to a zip file containing multiple disparate datasets, then returning a mapping is appropriate.
- Parameters
input_key (str) – An input key matching the DataReader’s regex pattern that should be used to load data.
- Returns
Union[xr.Dataset, Dict[str, xr.Dataset]] –
- The raw data extracted from the
provided input key.
- class tsdat.io.readers.ZarrReader[source]¶
Bases:
tsdat.io.base.DataReader
Uses xarray’s Zarr capabilities to read a Zarr archive and extract its contents into an xarray Dataset object.
Class Methods
Reads data given an input key.
Method Descriptions
- read(self, input_key: str) xarray.Dataset [source]¶
Reads data given an input key.
Uses the input key to open a resource and load data as a xr.Dataset object or as a mapping of strings to xr.Dataset objects.
In most cases DataReaders will only need to return a single xr.Dataset, but occasionally some types of inputs necessitate that the data loaded from the input_key be returned as a mapping. For example, if the input_key is a path to a zip file containing multiple disparate datasets, then returning a mapping is appropriate.
- Parameters
input_key (str) – An input key matching the DataReader’s regex pattern that should be used to load data.
- Returns
Union[xr.Dataset, Dict[str, xr.Dataset]] –
- The raw data extracted from the
provided input key.