-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
In my data pipelines, I have been repeatedly burned using indexing notation to grab a few variables from a dataset in the following way:
ds = xr.Dataset(...)
vars = ('a' , 'b', 'c')
ds[vars] # this errors
ds[list(vars)] # this is ok
Moreover, because Dataset__getitem__ is type unstable, it makes it hard to detect this kind of error using mypy, so it often appears 30 minutes into a long data pipeline. It would be great to have a type-stable method that can take any sequence of variable names and return the Dataset consisting of those variables and their coordinates only. In fact, this method already exists, but it currently not public API. Could we make it so? Thanks.