-
-
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
Attrs are lost in mathematical computation #1271
Comments
Historically, we dropped attributes in arithmetic because attributes are often used for units and we didn't want to do computation that results in the wrong units. Blinding propagating metadata can lead to it ending up in the wrong place. Also, if you are combining multiple DataArray objects with different But in practice, this is something that a lot of people want (better to have stale metadata than no metadata at all), so maybe I made the wrong choice here. At the very least, I would be comfortable with an option to set |
Thank you for the information. My sense is closest to the option 3 in #131. |
Coordinate reference systems (crs) are an example of attribute which is always valid after selection, arithmetic, or even reduction since they apply to the coordinates of the DataArray. A global option to keep certain attrs (like |
Could the setting not be module-wide, but be set on I'd like to have the option of specifying specific attributes that should be kept, or maybe dropped. It will be really annoying to need to keep copying the |
I wonder if it might make sense to represent The main reason why this is annoying is that
I would strong prefer to avoid making the xarray data model more complex by adding another type of metadata (e.g., in addition to Either way, this issue is related to the fuller "hook" system for customized attribute handling that I imagined over in #988. |
This looks like a brilliant idea, thanks! |
Understood. |
Related to #138
Why is
keep_attrs
option in reduce method set to FALSE by default?I feel it is more natural to keep all the attrs after some computation that returns xr.DaraArray
Such as
data*100
.(By it is not possible to set this option TRUE when using an operator.)
Is it an option to move this option to init method, in case of TRUE all the attrs are tracked after computations of the object and also the object generated from this object?
The text was updated successfully, but these errors were encountered: