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
Applying reduction operations like .mean() to a Dataset or DataArray will remove all coordinates that have the reduced dimension.
Describe the solution you'd like
I would like a keyword argument (reduce_coords?) in the reduction method to allow for the reduction to also be applied to the coordinates.
Describe alternatives you've considered
A current solution is to promote the coordinates to variables, perform the reduction and then demote them back to coordinates, like in #1497 . But it would be nice to have a faster way of doing it, like in #3033 with keepdims=True to retain the dimensions after a reduction.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the Contributing Guide for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!
This seems useful! Would it perhaps make sense to simply change the behaviour of keepdims to not drop coordinates which depend on the reduced dimension? To avoid adding more flags than might be necessary? That would be a breaking change though...
Yes, that could also work. Although (in my case) I only need the reduced coordinate without the reduced dimension, but it is still much easier to just take out the reduced dimension after the operation than the workaround I mentioned in the post. However, I do not know what is easier to implement.
Is your feature request related to a problem?
Applying reduction operations like .mean() to a Dataset or DataArray will remove all coordinates that have the reduced dimension.
Describe the solution you'd like
I would like a keyword argument (reduce_coords?) in the reduction method to allow for the reduction to also be applied to the coordinates.
Describe alternatives you've considered
A current solution is to promote the coordinates to variables, perform the reduction and then demote them back to coordinates, like in #1497 . But it would be nice to have a faster way of doing it, like in #3033 with keepdims=True to retain the dimensions after a reduction.
Additional context
No response
The text was updated successfully, but these errors were encountered: