isel(): Clean up logic, improve docs, and fix UxDataset.isel(..., ignore_grid=True) crash - #1684
Open
Sevans711 wants to merge 4 commits into
Open
isel(): Clean up logic, improve docs, and fix UxDataset.isel(..., ignore_grid=True) crash#1684Sevans711 wants to merge 4 commits into
isel(): Clean up logic, improve docs, and fix UxDataset.isel(..., ignore_grid=True) crash#1684Sevans711 wants to merge 4 commits into
Conversation
see #1683 for details. Still need to add regression test for the UxDataArray.isel(..., ignore_grid=True) case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1683
Overview
Implements all fixes and suggestions from #1683.
Bug fix:
The following lines used to crash, but now succeed:
The originally-reported bug was slightly misleading in that it claimed
uxds.isel(..., ignore_grid=True)crashed. In fact, that method does not actually crash directly. But, it does lead to a resultingUxDatasetwithout auxgrid, so when it is the last line in a Jupyter notebook cell and Jupyter attempts to display it, it crashed upon attempting to accessuxgrid. This crash no longer occurs in this PR.Added a regression test which fails on main but succeeds after this fix.
Cleanup of confusing logic and redundant error message handling:
With numbers here corresponding to numbers in original issue report:
len(grid_dims)>1 and not ignore_grid(which should be unreachable due to_validate_indexerscrashing earlier on in that case).Docstring improvements
With numbers here corresponding to numbers in original issue report:
ignore_grid=Truebehavior in docstring, including the phrase:CAUTION: using ignore_grid=True will cause the result's data to be inconsistent with its underlying grid, if any grid dimensions were sliced.PR Checklist
General
Testing & Benchmarking
Documentation
docs/api.rst_)AI Disclosure
AI Usage: just GitHub Copilot's inline code suggestions.