Allow setting (or skipping) new indexes in open_dataset #8051
+43
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
whats-new.rst
api.rst
This PR introduces a new boolean parameter
set_indexes=True
toxr.open_dataset()
, which may be used to skip the creation of default (pandas) indexes when opening a dataset.Currently works with the Zarr backend:
I'll add it to the other Xarray backends as well, but I'd like to get your thoughts about the API first.
xr.open_dataset()
? There are already many...BackendEntrypoint.open_dataset()
API?xr.open_dataset()
set_indexes
in the signature in addition to thedrop_variables
parameter, this is a breaking change for all existing 3rd-party backends. Or should we groupset_indexes
with the other xarray decoder kwargs? This would feel a bit odd to me as setting indexes is different from decoding data.Currently 1 and 2 are implemented in this PR, although as I write this comment I think that I would prefer 3. I guess this depends on whether we prefer
open_***
vs.xr.open_dataset(engine="***")
and unless I missed something there is still no real consensus about that? (e.g., #7496).