_reduce#
- xarray_einstats.einops._reduce(da, reduction, out_dims, in_dims=None, dim_lengths=None)[source]#
Wrap einops.reduce.
This is the function that actually interfaces with
einops
.xarray_einstats.einops.rearrange
is the user facing version as it exposes two possible APIs, one of them significantly less verbose and more friendly (but much less flexible).- Parameters:
- da
xarray.DataArray
Input DataArray to be reduced
- reduction
str
orcallable
One of available reductions (‘min’, ‘max’, ‘sum’, ‘mean’, ‘prod’) by
einops.reduce
, case-sensitive. Alternatively, a callablef(tensor, reduced_axes) -> tensor
can be provided.reduced_axes
are passed as a list of int.- out_dims
list
ofstr
,list
ordict
The output pattern for the dimensions. The dimensions present in
- in_dims
list
ofstr
ordict
, optional The input pattern for the dimensions. This is only necessary if you want to split some dimensions.
- dim_lengths
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