xarray_einstats.einops.rearrange(da, out_dims, in_dims=None, **kwargs)[source]#

Wrap einops.rearrange.


Input DataArray to be rearranged

out_dimslist of str, list or dict

The output pattern for the dimensions. The dimensions present in

in_dimslist of str or dict, optional

The input pattern for the dimensions. This is only necessary if you want to split some dimensions.

kwargsdict, optional

kwargs with key equal to dimension names in out_dims (that is, strings or dict keys) are passed to einops.rearrange the rest of keys are passed to xarray.apply_ufunc

See also


Cruder wrapper of einops.rearrange, allowed characters in dimension names are restricted

xarray.DataArray.transpose, xarray.Dataset.transpose
xarray.DataArray.stack, xarray.Dataset.stack


Unlike for general xarray objects, where dimension names can be hashable here dimension names are not recommended but required to be strings.