NetCDFDataIo

class glotaran.builtin.io.netCDF.netCDF.NetCDFDataIo(format_name: str)[source]

Bases: DataIoInterface

Plugin for NetCDF4 data io.

Initialize a Data IO plugin with the name of the format.

Parameters:

format_name (str) – Name of the supported format an instance uses.

Methods Summary

load_dataset

Load a *.nc file into a xarray.Dataset or xarray.DataArray.

save_dataset

Write a xarray.Dataset to the *.nc at path file_name.

Methods Documentation

load_dataset(file_name: str) Dataset | DataArray[source]

Load a *.nc file into a xarray.Dataset or xarray.DataArray.

Parameters:

file_name (str) – Path to the *.nc file that should be loaded.

Return type:

xr.Dataset | xr.DataArray

save_dataset(dataset: Dataset, file_name: str, *, data_filters: list[str] | None = None)[source]

Write a xarray.Dataset to the *.nc at path file_name.

Parameters:
  • dataset (xr.Dataset) – xarray.Dataset that should be written to file.

  • file_name (str) – Path of the file to write dataset to.

  • data_filters (list[str] | None) – List of data variable names that should be written to file. Defaults to None.