stack

Utilities for stacking/unstacking dimensions

xarray_extras.stack.proper_unstack(array: xarray_extras.stack.T, dim: collections.abc.Hashable) xarray_extras.stack.T

Work around an issue in xarray that causes the data to be sorted alphabetically by label on unstack():

https://github.com/pydata/xarray/issues/906

Also work around issue that causes string labels to be converted to objects:

https://github.com/pydata/xarray/issues/907

Parameters
  • array – xarray.DataArray or xarray.Dataset to unstack

  • dim (str) – Name of existing dimension to unstack

Returns

xarray.DataArray or xarray.Dataset with unstacked dimension