-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cumsum
providing correct behavior for non-coordinate DataArrays?
#1335
Comments
I'm not sure that whether coordinates should play a role here, but rather the dimensionality of the data (i.e. maybe xarray could infer that the data has one dimension and work on that axis?). I personally find the numpy behavior with ndarrays (flattening the array before applying cumsum) quite dangerous, I would rather like it to raise an error... a = np.arange(12).reshape((4, 3))
np.cumsum(a)
array([ 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]) |
Thanks @fmaussion, it just seems strange that if the data is one-dimensional we return an error. I would agree that we probably want an error for dimensionality larger than one. I think the thing to change here is to make |
Yes, it would be reasonable to not require specifying the dimension for one-dimensional arguments. I recall this coming up before for other methods, but can't remember the particulars now. |
Someone also wanted a default dimension for |
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here or remove the |
In the case of a DataArray without coordinates, should cumsum work without specifying an axis, e.g.,
da.cumsum()
is valid? This is not currently the obtained behavior.The text was updated successfully, but these errors were encountered: