raw_reduce#
- xarray_einstats.einops.raw_reduce(da, pattern, reduction, **kwargs)[source]#
Crudely wrap einops.reduce.
Wrapper around einops.reduce with a very similar syntax. Spaces, parenthesis
()and -> are not allowed in dimension names.- Parameters:
- da
xarray.DataArray Input array
- pattern
str Pattern string. Same syntax as patterns in einops with two caveats:
Unless splitting or stacking, you must use the actual dimension names.
When splitting or stacking you can use (dim1 dim2)=dim. This is necessary for the left hand side as it identifies the dimension to split, and optional on the right hand side, if omitted the stacked dimension will be given a default name.
- 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.- kwargs
dict, optional Passed to
xarray_einstats.einops.reduce
- da
- Returns:
See also
xarray_einstats.einops.reduceMore flexible and powerful wrapper over einops.reduce. It is also more verbose.
xarray_einstats.einops.rename_kwarg,xarray_einstats.einops.raw_rearrange