Fix grounding line mask definition when creating landice meshes#935
Open
trhille wants to merge 1 commit intoMPAS-Dev:mainfrom
Open
Fix grounding line mask definition when creating landice meshes#935trhille wants to merge 1 commit intoMPAS-Dev:mainfrom
trhille wants to merge 1 commit intoMPAS-Dev:mainfrom
Conversation
Fix grounding line mask definition, which previously marked the entire ocean as the grounding line used for setting cell widths.
Collaborator
Author
trhille
commented
Feb 26, 2026
|
|
||
| not_grounded_mask = np.logical_not(np.roll(grounded_mask, | ||
| n, axis=[0, 1])) | ||
| not_grounded_mask = np.logical_and( |
Collaborator
Author
There was a problem hiding this comment.
I'm not sure this is the most straightforward way to define this. I have trouble thinking through the logic with these rolled arrays. If @matthewhoffman or @xylar has ideas about making this simpler, I'd be happy to hear them.
Member
There was a problem hiding this comment.
I also find these things confusing. ChatGPT suggested this as an alternative:
shifted_grounded = np.roll(grounded_mask, n, axis=[0, 1])
shifted_float = np.roll(float_mask, n, axis=[0, 1])
not_grounded_mask = (~shifted_grounded) & shifted_float
Side question: would it be more accurate to rename not_grounded_mask to neighbor_not_grounded_mask?
Member
|
@trhille , the maps look great and I like that you are now saving them out. I am happy to approve & merge once we're happy with that question about the logic for the masks. |
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.



This merge fixes grounding line mask definition, which previously marked the entire ocean as the grounding line used for setting cell widths. It also saves maps of the margin and grounding-line masks, which will be helpful for debugging purposes when new maps are added or mask definitions are changed.
Checklist
Testingin this PR) any testing that was used to verify the changes