issues: 1908161401
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1908161401 | I_kwDOAMm_X85xvDt5 | 8225 | Scalar coordinates should not be footloose | 3383837 | closed | 0 | 5 | 2023-09-22T04:28:11Z | 2023-09-25T16:10:40Z | 2023-09-25T16:10:40Z | CONTRIBUTOR | Is your feature request related to a problem?A scalar coordinate has the counter-intuitive property of being able to hop from one data variable to another. ``` import xarray as xr a = xr.Dataset(
data_vars={"a": (("x",), [0, 0])},
coords={
"x": [0.1, 2.3],
"y": 42,
},
)
b = xr.Dataset(
data_vars={"b": ("x", [1, 1])},
coords={
"x": [0.1, 2.3],
},
)
c = xr.merge((a, b))
Describe the solution you'd likeI would like each data variable in a dataset to keep track of its own scalar coordinates (as they can, of course and absolutely essentially, do for dimension coordinates). To continue the example above, I think Describe alternatives you've consideredNo response Additional contextI think this feature could also help with #4501, wherein squeezing demotes a length-one non-dimensional coordinate to a scalar coordinate without tracking its own scalar coordinate. Egads, that's an ugly sentence. I'll elaborate over there. Most importantly, this feature would solve a real problem I've encountered: model outputs, one for each combination of model parameters, that record parameters as a scalar coordinate only on the data variables the parameter affects. If you want to concatenate these together with XArray, you invariably get a lot of unncecessary data duplication. A contrived example with two outputs, in which the "temp" variable depends on parameter "time" but the "pressure" variable does not:
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8225/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |