reduce#
- xarray_einstats.einops.reduce(da, reduction, out_dims, in_dims=None, **kwargs)[source]#
Wrap einops.reduce.
- Parameters:
- da
xarray.DataArray Input DataArray to be reduced
- reduction
strorcallable One of available reductions (‘min’, ‘max’, ‘sum’, ‘mean’, ‘prod’) by
einops.reduce, case-sensitive. Alternatively, a callablef(tensor, reduced_axes) -> tensorcan be provided.reduced_axesare passed as a list of int.- out_dims
listofstr,listordict The output pattern for the dimensions. The dimensions present in
- in_dims
listofstrordict, optional The input pattern for the dimensions. This is only necessary if you want to split some dimensions.
- kwargs
dict, 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 toxarray.apply_ufunc
- da
See also
xarray_einstats.einops.raw_reduceCruder wrapper of einops.rearrange, allowed characters in dimension names are restricted
xarray_einstats.einops.rearrange,xarray_einstats.einops.raw_rearrange
Notes
Unlike for general xarray objects, where dimension names can be hashable here dimension names are not recommended but required to be strings.