spectrochempy.to_xarray

to_xarray()[source]

Convert a NDDataset instance to an Dataset object.

Same-dimension CoordSet coordinates (multiple numeric coordinates sharing a dimension) are exported as a dimension coordinate for the default coordinate and non-dimension coordinates for auxiliary coordinates, with scpy_coord_role and scpy_owner_dim markers.

Portable string labels on coordinates (1D string-only labels with no mixed types) are exported as non-dimension coordinate variables with scpy_coord_role="label". Non-exportable labels trigger a warning.

Warning: the xarray library must be available.

Returns:

object – An xarray.Dataset object.