exception to indexed-coordinate only inheritance for `coordinates` encoding
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the DataTree.from_dict example and the decode_cf=True path, then trace the existing indexed-coordinate inheritance behavior discussed in issues #9475 and #10812. Determine how CF coordinates encodings are resolved across groups and define tests for same-group and inherited auxiliary coordinates. Done means in-scope coordinates are set and inherited when necessary without creating indexes automatically.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem?
From review of #9475, #10812, and linked PRs, I partially understand the difficulty involved in resolving questions around shared coordinates within datatrees. The decision to support inheritance for indexed-coordinates makes a lot of sense. I think there is a practical use-case for allowing additional inheritance: when decode_cf=True and a CF-Conventions compliant coordinates attribute implies inheritance.
Here is an example of a CF-Convention coordinates attribute:
xarray.DataTree.from_dict(
{
"x": [0, 1],
"y": [0, 1, 2],
"lon": (("x", "y"), [[0, 0, 0], [1, 1, 1]]),
"lat": (("x", "y"), [[0, 1, 2], [0, 1, 2]]),
"products/temp": (
("x", "y"), [[4, 6, 2], [5, 7, 3]], None, {"coordinates": "/lon /lat"}
),
},
)
or in netCDF's CDL:
dimensions:
x = 2 ;
y = 3 ;
variables:
int64 x(x) ;
int64 y(y) ;
int64 lon(x, y) ;
int64 lat(x, y) ;
group: products {
variables:
int64 temp(x, y) ;
temp:coordinates = "/lon /lat" ;
} // group products
Describe the solution you'd like
When a data variable's encoding includes coordinates that identify an "auxiliary coordinate variable" (sensu NUG) or "non-indexed coordinate" (sensu XArray) that is within scope, then that variable should be set as a coordinate and inherited if necessary.
I add "if necessary", because the in-scope coordinate could be within the same group. In which case there is nothing to inherit.
Describe alternatives you've considered
Any variable encoded in a coordinates string could have a (possibly multi-dimensional) index created automatically; so that the indexed-coordinate only inheritance is preserved. I think that would be too expensive.
Additional context
I am supporting refinement of netCDF files distributed by a NASA DAAC, and understanding how XArray is thinking about absolute and relative path-like elements of coordinates encodings would really help us help our data users.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 74
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pydata/xarray
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
`DataTree.map_over_datasets` behavior can be obscure sometimesPossibly taken @mohansree14 claimed this 23 days ago. Openneeds triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pydata/xarray#11813 · 1 comment ·
Maintainers usually reply within 1 day
-
Comparing attrs that contain a dict of NumPy arrays raises ValueError in identical / assert_identicalPossibly taken @SohamXYZDev claimed this 29 days ago. Openbug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
pydata/xarray#11777 · 1 comment ·
Maintainers usually reply within 1 day
-
RangeIndex` with datetime64 bounds cannot be printed (`Unknown format code 'g'`)Possibly taken @d-chambers claimed this 60 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pydata/xarray#11598 · 3 comments ·
Maintainers usually reply within 1 day
-
DataTree constructor error message says dict even though dict is not acceptedPossibly taken @aryansk claimed this 100 days ago. Openbug contrib-good-first-issue topic-DataTree topic-error reporting
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pydata/xarray#11514 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
tests
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[Plugin] 群聊记忆 · 人格养成Open
Difficulty 1/5 1-3 hours Newbie friendliness 74/100
-
bug maintainer-managed
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
awslabs/visual-asset-management-system#1759 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100