You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<xarray.DataArray (c: 2)>array([110, 125])
Dimensionswithoutcoordinates: c
To sum over all dimensions:
xr.dot(da_a, da_b, dims=['a', 'b', 'c'])
<xarray.DataArray (c: 2)>array([110, 125])
Dimensionswithoutcoordinates: c
Problem Description
xr.dot with dims=None currently sums over all the common dimensions. However, there are cases when a sum over all dimensions is desired. E.g. xr.dot(da_a, da_b, dims=['a', 'b', 'c']) is a a memory efficient way to compute (da_a * da_b).sum() (if a and b don't share the same dimensions). This is currently used in #2922 (example).
Therefore I suggest to allow xr.dot(da_a, da_b, dims=xr.ALL_DIMS) as shortcut to sum over all dimensions.
I assume there is no intent to change the behavior of xr.dot(..., dims=None)? (As it is a bit in contrast to other functions that are mostly applied over all dimensions.)
MCVE Code Sample
This sums over the common dimensions:
To sum over all dimensions:
Problem Description
xr.dot
withdims=None
currently sums overall the common dimensions
. However, there are cases when a sum over all dimensions is desired. E.g.xr.dot(da_a, da_b, dims=['a', 'b', 'c'])
is a a memory efficient way to compute(da_a * da_b).sum()
(ifa
andb
don't share the same dimensions). This is currently used in #2922 (example).Therefore I suggest to allow
xr.dot(da_a, da_b, dims=xr.ALL_DIMS)
as shortcut to sum over all dimensions.I assume there is no intent to change the behavior of
xr.dot(..., dims=None)
? (As it is a bit in contrast to other functions that are mostly applied over all dimensions.)@fujiisoup @max-sixty
Output of
xr.show_versions()
The text was updated successfully, but these errors were encountered: