Skip to content

Commit

Permalink
Zero Out Corner + 3 Cell
Browse files Browse the repository at this point in the history
  • Loading branch information
manishvenu committed Dec 26, 2024
1 parent 0b672a8 commit 3ae3071
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion regional_mom6/regridding.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def get_boundary_mask(
# Corner Q-points defined as land should be zeroed out
if np.isnan(boundary_mask[0]):
boundary_mask[0] = zero_out
if np.isnan(boundary_mask[-1] == land):
if np.isnan(boundary_mask[-1]):
boundary_mask[-1] = zero_out

return boundary_mask
Expand Down Expand Up @@ -615,6 +615,18 @@ def mask_dataset(

## Remove Nans if needed ##
ds[var] = ds[var].fillna(0)
elif np.isnan(dataset_reduce_dim[0]): # The corner is nan in the data
ds[var] = ds[var].copy()
ds[var][..., 0, 0] = 0
elif np.isnan(dataset_reduce_dim[-1]): # The corner is nan in the data
ds[var] = ds[var].copy()
if orientation in ["east", "west"]:
ds[var][..., -1, 0] = 0
else:
ds[var][..., 0, -1] = 0

## Remove Nans if needed ##
ds[var] = ds[var].fillna(0)

## Apply the mask ## # Multiplication allows us to use 1, 0, and nan in the mask
ds[var] = ds[var] * mask
Expand Down

0 comments on commit 3ae3071

Please sign in to comment.