Repository navigation
Conversation
SCRIP stores corner coordinates rather than node indices and has no fill value for them, so `_encode_scrip` wrote NaN into the slots of a short face. The reader deduplicates corners into nodes, so that NaN becomes a node of its own: a 5-node grid reloads with `n_node` 6, one node at NaN/NaN, poisoning every downstream geometry calculation. Pad instead the way SCRIP itself does, by repeating the last valid corner, and collapse those repeats back to fill values on read. Repeats drop keeping the first occurrence, so winding order survives and a closed ring collapses like a trailing repeat; a cell that would fall below three vertices is degenerate in the source file and is left visible rather than packed into a face no polygon routine can use. Also adds `TestIOWriteRoundTrip`, covering all four writable formats: the encoders share a family of padding bugs that raise nothing and simply grow the mesh, so these assert on the reloaded topology rather than on the write succeeding. The esmf and exodus cases depend on the other fixes in this series: the Exodus face-order cases are marked strict xfail here, so the suite stays green until that fix lands and then forces the marker out. Adapted to the reader as it now stands. The SCRIP dedup can stay lazy (dask, with chunks=), so the collapse is a Numba kernel run per block that keeps the connectivity lazy, and runs in place on the eager path to avoid a connectivity-sized copy. Corners missing from the file (NaN, from files written before this fix) are now marked INT_FILL_VALUE rather than -1, and the collapse skips fill slots: a -1 would otherwise pass through as a valid node index that wraps to the last node. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #1911
Overview
SCRIP stores corner coordinates rather than node indices and has no fill value for them, so
_encode_scripwrote NaN into the slots of a short face. The reader deduplicates corners into nodes, so that NaN becomes a node of its own: a 5-node grid reloads withn_node6, one node at NaN/NaN, poisoning every downstream geometry calculation.Pad instead the way SCRIP itself does, by repeating the last valid corner, and collapse those repeats back to fill values on read. Repeats drop keeping the first occurrence, so winding order survives and a closed ring collapses like a trailing repeat; a cell that would fall below three vertices is degenerate in the source file and is left visible rather than packed into a face no polygon routine can use.
Also adds
TestIOWriteRoundTrip, covering all four writable formats: the encoders share a family of padding bugs that raise nothing and simply grow the mesh, so these assert on the reloaded topology rather than on the write succeeding. The esmf and exodus cases depend on the other fixes in this series: the Exodus face-order cases are marked strict xfail here, so the suite stays green until that fix lands and then forces the marker out.Adapted to the reader as it now stands. The SCRIP dedup can stay lazy (dask, with chunks=), so the collapse is a Numba kernel run per block that keeps the connectivity lazy, and runs in place on the eager path to avoid a connectivity-sized copy. Corners missing from the file (NaN, from files written before this fix) are now marked INT_FILL_VALUE rather than -1, and the collapse skips fill slots: a -1 would otherwise pass through as a valid node index that wraps to the last node.
PR Checklist
General
Testing & Benchmarking
Documentation and Examples
docs/api.rst; internal (private) function names start with an underscore (_)AI Disclosure
AI Usage: Claude Opus 5.5