pydata / pydata/xarray

Refactor Dataset internals to store data variables and coordinate variables as separate dicts

Open
#9,203 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-DataTree topic-internals
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 DataTree node is still not just those on a Dataset plus the inherited coordinates

This is indeed a bit of a con, but in my mind the right fix is probably to adjust the Dataset data model to using dictionaries of data_variables and coord_variables, rather than the current solution of a dict of variables and a set of coord_names. Using a separate dictionary for coord_variables would also be more aligned with how DataArray is implemented. The internal Dataset data 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.