scipp.compat.from_xarray#

scipp.compat.from_xarray(obj)#

Convert an xarray object to the corresponding scipp object. Attributes named “units” are used to set the units of the Variables. All other DataArray attributes are kept, but attributes of Variables, Coordinates and Datasets are dropped.

Parameters

obj (Union[Variable, DataArray, Dataset]) – The xarray object to convert.

Returns

Union[Variable, DataArray, Dataset, DataGroup] – The converted scipp object.