Allow data variables paths instead of just names in xarray.concat when passing DataTrees
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
Start at _datatree_concat and trace how it passes data_vars to _dataset_concat for each node. Check the existing xarray.concat DataTree behavior and tests before implementing path splitting; done means paths select only the requested variables across the relevant nodes, while the wildcard behavior should be addressed only if its scope is clear.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem?
The current implementation of xarray.concat does not allow to specify paths of data variables that should be concatenated when operating on DataTrees. Instead, the data_vars argument is passed on to _dataset_concat calls unaltered on the individual nodes, so that passing a list of data variable names only works if those variables are present at all nodes of the trees.
Describe the solution you'd like
I would like to be able to specify a list of paths to data variables, e.g.
xr.concat((datatree_a, datatree_b), dim=xr.Variable("new_dim", ["a", "b"]), data_vars=["path/to/data_var_1", "path/to/data_var_2"])
The implementation of _datatree_concat would have to split the paths and then call _dataset_concat on each node only with the data vars prefixed with the path of each node.
Describe alternatives you've considered
No response
Additional context
Ideally, wildcards would be allowed both in the path and in the name of the data variable, this could easily be achieved using Pythons fnmatch module.
- 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