tsdat.io.readers

Classes

CSVReader

Uses pandas and xarray functions to read a csv file and extract its contents into an

NetCDFReader

Thin wrapper around xarray's open_dataset() function, with optional parameters

ParquetReader

Uses pandas and xarray functions to read a parquet file and extract its contents

ZarrReader

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 Parameters[source]

Bases: pydantic.BaseModel

from_dataframe_kwargs :Dict[str, Any][source]
read_csv_kwargs :Dict[str, Any][source]
parameters :CSVReader.Parameters[source]

Class Methods

read

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.

parameters :Dict[str, Any][source]

Class Methods

read

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 Parameters[source]

Bases: pydantic.BaseModel

from_dataframe_kwargs :Dict[str, Any][source]
read_parquet_kwargs :Dict[str, Any][source]
parameters :ParquetReader.Parameters[source]

Class Methods

read

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 Parameters[source]

Bases: pydantic.BaseModel

open_zarr_kwargs :Dict[str, Any][source]
parameters :ZarrReader.Parameters[source]

Class Methods

read

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.