-
-
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
keep attrs in xarray.where #4687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thanks @keewis . Could add a whatsnew if you want.
After thinking about this some more, I decided that it would be good to have the behavior of I also added a entry to Edit: it seems this also preserves the name of |
I guess But that reasoning would also say we should not propagate |
yes, that's true. Maybe that's why we did not propagate the |
I would think the closest match is to return from |
Great idea! |
I'm not sure how to implement that: I can get there by replacing |
Is that because |
yes, exactly. However, I think it would be easier to extend |
Shall we merge? |
I'm hoping to wait until |
Hi, I have a question about this fix relating to coordinate attributes (and am not sure if that deserves a separate issue): |
yes, that's the plan (we changed the I'm a bit busy right now, but once things calm down a bit I'll try to finish this. |
Shall we merge this? |
I believe it is best to allow customizing the behavior, so I added a Edit: using a different |
Thanks @keewis |
Since that question came up at least twice, this allows changing the behavior of
where
using thekeep_attrs
option.Dataset.where
andDataArray.where
always usekeep_attrs=True
(set inops.where_method
), so we could probably copy that.Edit: we should also document that only the attributes of
cond
will be preserved.isort . && black . && mypy . && flake8
whats-new.rst