Refactor Dataset internals to store data variables and coordinate variables as separate dicts
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
There's a lot of other discussion in #9063, but I wanted to pull out this suggestion for independent discussion:
- Our list of internal attributes on a
DataTreenode is still not just those on aDatasetplus the inherited coordinatesThis is indeed a bit of a con, but in my mind the right fix is probably to adjust the
Datasetdata model to using dictionaries ofdata_variablesandcoord_variables, rather than the current solution of a dict ofvariablesand a set ofcoord_names. Using a separate dictionary forcoord_variableswould also be more aligned with howDataArrayis implemented. The internalDatasetdata model is a hold-over from the very early days of Xarray, before we had a notion of coordinate variables that are not indexes.
Originally posted by @shoyer in https://github.com/pydata/xarray/issues/9063#issuecomment-2198775511
Contributor 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.
Research direction
Review the current Dataset model using a variables dictionary and coord_names, then compare it with DataArray's separate coordinate representation and the DataTree attribute concern described here. Identify the affected internal APIs and tests before changing them; done means Dataset stores data variables and coordinate variables separately while preserving the expected DataTree behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100