Repository navigation
Fix subset crashes for edge-centered data if face_edge_connectivity isn't populated - #1899
Open
lucas-santos-f wants to merge 1 commit into
Open
lucas-santos-f wants to merge 1 commit into
lucas-santos-f wants to merge 1 commit into
Conversation
…sn't populated bounding_box(), bounding_circle() and nearest_neighbor() on edge-centered data raised a KeyError for _subgrid_edge_indices when the grid had no face_edge_connectivity yet, because the grid subset only slices edges when that connectivity exists. Build it before subsetting, the same way UXARRAY#1875 does for isel(). Closes UXARRAY#1888
Sevans711
self-requested a review
November 16, 2026 16:06
Collaborator
|
Hi @lucas-santos-f, thank you for opening this PR! I wanted to send a quick followup to let you know that this is on the uxarray team's to-do list, but reviews might not happen for a while (possibly a few weeks or more) since the underlying issue isn't necessarily a high priority right now. Although, if you or any uxarray users have encountered this issue directly while using uxarray, please feel free to mention that here, as that could certainly influence the priority level. No pressure to answer this part, it is unrelated to this PR's contents, but if you are willing to share, what motivated you to contribute to uxarray? We are always trying to learn more about what leads people to find / use / contribute to uxarray! |
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 #1888
Overview
UxDataArray.subset.bounding_box(),bounding_circle()andnearest_neighbor()slice the grid first and then slice the data with the indices the grid subset stores. For edge-centered data those are_subgrid_edge_indices, and_slice_face_indicesonly stores them when the grid already hasface_edge_connectivity, so on a grid where it hadn't been built yet they raisedKeyError: No variable named '_subgrid_edge_indices'.The accessor now builds
face_edge_connectivitybefore subsetting when the data has ann_edgedimension, the same fix #1875 makes inisel(). Face- and node-centered data are not affected. The other subset methods don't need it:constant_latitude()andconstant_longitude()only accept face-centered data, andconstant_latitude_interval()/constant_longitude_interval()go throughisel(), so #1875 covers them (checked with #1875 applied on top of this branch). With both in, every subset method either works on edge-centered data or raises the existing face-centered-only error.The new test runs the three methods on the
quad-hexagonedge data, each selecting one face, and checks that the result holds the data on that face's six edges. It fails onmainwith theKeyErrorabove and passes with this change.pytest testpasses (1287 passed, 1 skipped, Python 3.13 on Windows) and pre-commit is clean.Happy to adjust anything if needed.
PR Checklist
General
Testing & Benchmarking
Documentation and Examples
docs/api.rst; internal (private) function names start with an underscore (_)AI Disclosure
AI Usage: Claude Code (Claude Opus 5.5) traced the cause, wrote the fix and the test, and ran the checks.
AI disclosure: this change was written with the help of Claude Code (Claude Opus 5.5).