Fix grounding line mask definition when creating landice meshes#935
Fix grounding line mask definition when creating landice meshes#935trhille wants to merge 2 commits intoMPAS-Dev:mainfrom
Conversation
compass/landice/mesh.py
Outdated
|
|
||
| not_grounded_mask = np.logical_not(np.roll(grounded_mask, | ||
| n, axis=[0, 1])) | ||
| not_grounded_mask = np.logical_and( |
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.
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?
There was a problem hiding this comment.
@matthewhoffman I think not_grounded_mask is consistent with the other variable names in this block, which are all looking over neighbors.
There was a problem hiding this comment.
Okay, I checked your logic and found that it's equivalent to the existing logic. It's easier to read, so I added that in commit dc22f87.
|
@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. |
Fix grounding line mask definition, which previously marked the entire ocean as the grounding line used for setting cell widths.
Simplify logic for creating margin and grounding-line masks for landice mesh creation.
d04d7ff to
dc22f87
Compare



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