{{ message }}
Fix gradient returning all NaN on SCRIP-derived grids#1533
Open
rajeeja wants to merge 1 commit into
Open
Conversation
a716a42 to
869903b
Compare
…re face Fixes #1452 — gradient() returned all NaN on SCRIP-derived grids (ne120np4) because _check_face_on_boundary falsely flagged every face as boundary.
869903b to
353f5c6
Compare
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.

Skip edges with incomplete
edge_face_connectivityin the gradient stencil instead of NaN-ing the entire face. Fixes #1452.The ne120np4 grid in #1452 is a spectral element cubed-sphere mesh read through SCRIP format. UXarray's SCRIP reader deduplicates corner coordinates with exact floating-point comparison, but SE grids compute shared boundary nodes independently per element, so coordinates at element junctions can differ by machine epsilon. This prevents node merging and produces edges that only one face claims, leaving
INT_FILL_VALUEinedge_face_connectivityfor most edges. The boundary check then falsely flags nearly every face and sets the gradient to NaN — exactly what @jpan84 observed (1 non-NaN value out of 777,602 faces).This fix skips those incomplete edges per-edge rather than rejecting the whole face, which is sufficient for exploratory analysis of smooth fields. The proper long-term fix is tolerance-based node deduplication in the SCRIP reader or native SE grid support (#1402).