stack_xarray_repdim

typhon.utils.stack_xarray_repdim(da, **dims)[source]

Like xarrays stack, but with partial support for repeated dimensions

The xarray.DataArray.stack method fails when any dimension occurs multiple times, as repeated dimensions are not currently very well supported in xarray (2018-03-26). This method provides a workaround so that stack can be used for an array where some dimensions are repeated, as long as the repeated dimensions are themselves not stacked.

Parameters:
  • da (DataArray) – DataArray to operate on.

  • **dims – Dimensions to stack. As for xarray.DataArray.stack.