tsdat.io.writers
¶
Classes¶
Converts a xr.Dataset object to a pandas DataFrame and saves the result to a csv |
|
Thin wrapper around xarray’s Dataset.to_netcdf() function for saving a dataset to a |
-
class
tsdat.io.writers.
CSVWriter
[source]¶ Bases:
tsdat.io.base.FileWriter
Converts a xr.Dataset object to a pandas DataFrame and saves the result to a csv file using pd.DataFrame.to_csv(). Properties under the to_csv_kwargs parameter are passed to pd.DataFrame.to_csv() as keyword arguments.
Class Methods
Writes the dataset to the provided filepath. This method is typically called by
Method Descriptions
-
write
(self, dataset: xarray.Dataset, filepath: Optional[pathlib.Path] = None) → None[source]¶ Writes the dataset to the provided filepath. This method is typically called by the tsdat storage API, which will be responsible for providing the filepath, including the file extension.
- Parameters
dataset (xr.Dataset) – The dataset to save.
filepath (Optional[Path]) – The path to the file to save.
-
-
class
tsdat.io.writers.
NetCDFWriter
[source]¶ Bases:
tsdat.io.base.FileWriter
Thin wrapper around xarray’s Dataset.to_netcdf() function for saving a dataset to a netCDF file. Properties under the to_netcdf_kwargs parameter will be passed to Dataset.to_netcdf() as keyword arguments.
File compression is used by default to save disk space. To disable compression set the use_compression parameter to False.
Class Methods
Writes the dataset to the provided filepath. This method is typically called by
Method Descriptions
-
write
(self, dataset: xarray.Dataset, filepath: Optional[pathlib.Path] = None) → None[source]¶ Writes the dataset to the provided filepath. This method is typically called by the tsdat storage API, which will be responsible for providing the filepath, including the file extension.
- Parameters
dataset (xr.Dataset) – The dataset to save.
filepath (Optional[Path]) – The path to the file to save.
-