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
This should print a dataarray with just the number 15 in it, but instead it throws the error
Traceback (most recent call last):
File "mwe.py", line 9, in <module>
sum = da.reduce(total_sum)
File "/home/tegn500/Documents/Work/Code/xarray/xarray/core/dataarray.py", line 1605, in reduce
var = self.variable.reduce(func, dim, axis, keep_attrs, **kwargs)
File "/home/tegn500/Documents/Work/Code/xarray/xarray/core/variable.py", line 1365, in reduce
axis=axis, **kwargs)
TypeError: total_sum() got an unexpected keyword argument 'axis'
This contradicts what the docstring of .reduce() says:
axis: int or sequence of int, optional
Axis(es) over which to repeatedly apply func. Only one of the ‘dim’ and ‘axis’
arguments can be supplied. If neither are supplied, then the reduction is
calculated over the flattened array (by calling f(x) without an axis argument).
The problem is that in variable.py an axis=None kwarg is always passed to func, even if no axis argument is given by the user in reduce.
The text was updated successfully, but these errors were encountered:
DataArray.reduce()
fails if you try to reduce using a function which doesn't accept any axis arguments.This should print a dataarray with just the number 15 in it, but instead it throws the error
This contradicts what the docstring of
.reduce()
says:The problem is that in
variable.py
anaxis=None
kwarg is always passed to func, even if no axis argument is given by the user inreduce
.The text was updated successfully, but these errors were encountered: