issue_comments: 43356581
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | performed_via_github_app | issue |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/pydata/xarray/issues/131#issuecomment-43356581 | https://api.github.com/repos/pydata/xarray/issues/131 | 43356581 | MDEyOklzc3VlQ29tbWVudDQzMzU2NTgx | 1217238 | 2014-05-16T17:17:16Z | 2014-05-16T17:17:16Z | MEMBER | You're right that keeping attributes fully intact under any operation is a perfectly reasonable alternative to dropping them. So what do NCO and CDO do with attributes when you calculate the variance along a dimension of a variable? The choices, as I see them, are: 1. Drop all attributes 2. Keep all attributes 3. Keep all attributes with the exception of "units" (which is dropped) 4. Keep all attributes, but modify "units" according to the mathematical operation For xray, 2 is out, because it leaves wrong metadata intact. 3 and 4 are out, because we don't want to be in the business of relying on metadata. This leaves 1 -- dropping all attributes. For consistency, if 1 is the choice we need to make for "variance", then the same rule should apply for all "reduce" operations, including apparently innocuous operations like "mean". Note that this is also consistent with how xray handles attributes all other mathematical operations -- even adding 0 or multiplying by 1 removes all attributes. My sense (not being a heavy user of these tools) is that NCO and CDO have a little bit more freedom to keep around metadata because they maintain a "history" attribute. Loading files from disk is a little different. Notice that once variables get loaded into xray, any attributes that were used for decoding have been removed from "attributes" and moved to "encoding". The meaningful attributes only exist on files on disk (unavoidable given the limitations of NetCDF). |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
33637243 |