This is development documentation. Some features are not available in the stable release. View stable documentation.

spectrochempy.to_netcdf

to_netcdf(filename=None, **kwargs)[source]

Persist this dataset to NetCDF using the canonical xarray mapping.

Auxiliary same-dimension coordinates are persisted automatically through the underlying to_xarray() output.

The current NetCDF portable subset is intentionally narrow:

  • one NDDataset;

  • default coordinates only;

  • auxiliary same-dimension coordinates (CoordSet sharing a dimension);

  • explicit mask variable support;

  • JSON-compatible metadata only;

  • complex data persisted through a split real/imag convention.

Parameters:
  • filename (path-like or file-like, optional) – Destination path or writable file-like object. If omitted, return the serialized NetCDF bytes produced by xarray.

  • **kwargs – Additional keyword arguments forwarded to xarray.Dataset.to_netcdf(). The default engine is scipy.

Returns:

object – The return value from xarray.Dataset.to_netcdf().