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 NetCDF prototype 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().