Skip to content

Commit dc22f87

Browse files
committed
Simplify mask logic
Simplify logic for creating margin and grounding-line masks for landice mesh creation.
1 parent d005ede commit dc22f87

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

compass/landice/mesh.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,12 @@ def get_dist_to_edge_and_gl(self, thk, topg, x, y,
521521
grounding_line_mask = np.zeros(sz, dtype='i')
522522

523523
for n in neighbors:
524-
not_ice_mask = np.logical_not(np.roll(ice_mask, n, axis=[0, 1]))
525-
margin_mask = np.logical_or(margin_mask, not_ice_mask)
524+
shifted_ice = np.roll(ice_mask, n, axis=[0, 1])
525+
margin_mask = np.logical_or(margin_mask, ~shifted_ice)
526526

527-
not_grounded_mask = np.logical_and(
528-
np.logical_not(np.roll(grounded_mask,
529-
n, axis=[0, 1])),
530-
np.roll(float_mask, n, axis=[0, 1]))
527+
shifted_grounded = np.roll(grounded_mask, n, axis=[0, 1])
528+
shifted_float = np.roll(float_mask, n, axis=[0, 1])
529+
not_grounded_mask = (~shifted_grounded) & shifted_float
531530
grounding_line_mask = np.logical_or(grounding_line_mask,
532531
not_grounded_mask)
533532

0 commit comments

Comments
 (0)