Utilities for stacking/unstacking dimensions

xarray_extras.stack.proper_unstack(array: xarray_extras.stack.T, dim: xarray_extras.stack.T

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

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

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

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


xarray.DataArray or xarray.Dataset with unstacked dimension