xarray
xarray copied to clipboard
Add Dataset.subset() method for type-stable variable selection
Addresses issue #3894 by providing a public API for selecting multiple variables that always returns a Dataset (unlike __getitem__) and accepts sequence types including tuples. This eliminates the need to convert tuples to lists when subsetting variables and provides better type stability for downstream code.
Unlike using __getitem__ with a list, an explicit method is more discoverable through IDE autocomplete and documentation.
- [x] Closes #3894
- [x] Tests added
- [x] User visible changes (including notable bug fixes) are documented in
whats-new.rst - [x] New functions/methods are listed in
api.rst
cc @eni-awowale