feat(grid): add ihc to UnstructuredGrid#2681
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2681 +/- ##
===========================================
+ Coverage 55.5% 72.8% +17.2%
===========================================
Files 644 667 +23
Lines 124135 130124 +5989
===========================================
+ Hits 68947 94741 +25794
+ Misses 55188 35383 -19805
🚀 New features to boost your workflow:
|
Member
Author
|
discussed offline with @jlarsen-usgs |
wpbonelli
added a commit
that referenced
this pull request
Jan 31, 2026
Improve the shared face finding algorithm for HFB (Horizontal Flow Barrier) plotting. Factor out @jlarsen-usgs's index-based approach from #2671 into reusable function(s) and use it instead of floating point comparisons as before. Should be faster. I moved the new face-related functions to a new module faceutil.py instead of plotutil.py as they are used not only for plotting but for export, and may be useful in other cases. I considered putting them in gridutil.py but that is used by the grid classes, while the face functions use the grid classes, so it would have created a circular import. I also changed the name of is_vertical_barrier -> is_vertical and inverted the semantics so it works on faces, not barriers (a face between horizontally adjacent cells is a vertical polygon, and a face between vertically adjacent cells is a horizontal polygon, but we call the former a "horizontal" flow barrier and the latter a "vertical" flow barrier). I figure writing these utils in terms of faces for the general case makes sense, and just interpreting the results for the specific case of HFBs. This PR builds on - #2671's shared face finding approach - #2680 which gives all grid types a consistent get_node() method - #2681 which adds an ihc init parameter/attribute to UnstructuredGrid Some ad hoc cell ID -> node number conversion utilities are removed and get_node() used instead. I am classifying all this a refactor though it introduces a new utility module, as the new utils are in service of the refactor.
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.
Add
ihc(horizontal connection) init parameter and property toUnstructuredGridand populate it from the DISU package when initializingMFModel.modelgrid. Then use it for vertical barrier detection inplotutil.pyinstead of floating point comparisons on coordinates, if available (but don't assume it's available).