pydata / pydata/xarray

DataTree: selecting via `[["a"]]` suggests `subset`, which is missing

Open
#10,014 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-DataTree
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

What happened?

calling dt[["a"]] suggests to use .subset which does not exist.

What did you expect to happen?

No response

Minimal Complete Verifiable Example
import xarray as xr
a = xr.Dataset(data_vars={"x": [10, 20]}, coords={"time": [0, 1]})

dt = xr.DataTree()
dt["a"] = a

dt[["a"]] # fails and suggests subset
dt.subset # fails
MVCE confirmation
  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.
  • Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output

Anything else we need to know?

No response

Environment

master

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

Start by running the provided Python example with xarray.DataTree, focusing on dt[["a"]] and the suggested dt.subset attribute. Trace the DataTree indexing and suggestion behavior, then confirm the completed fix no longer suggests a missing subset attribute for this selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.