Skip to content

Commit daba7a6

Browse files
committed
fixup
1 parent db4d9be commit daba7a6

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

mesh_generation/generate_mesh.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,17 @@ def mom6_mask_detection(ds, minimum_depth=0, masking_depth=None):
5959
raise ValueError("Cannot detect topog: dataset lacks 'depth' variable!")
6060
if minimum_depth < 0:
6161
raise ValueError("minimum depth cannot be negative")
62-
if masking_depth > minimum_depth:
63-
raise ValueError("MASKING_DEPTH must be less than or equal to MINIMUM_DEPTH!")
62+
6463
depth = ds["depth"]
6564

6665
# topog contains nans
6766
is_wet = ~np.isnan(depth)
6867

6968
if masking_depth is not None:
69+
if masking_depth > minimum_depth:
70+
raise ValueError(
71+
"MASKING_DEPTH must be less than or equal to MINIMUM_DEPTH!"
72+
)
7073
mask = (depth > masking_depth) & is_wet
7174
else:
7275
mask = (depth > minimum_depth) & is_wet
@@ -237,7 +240,7 @@ def __init__(
237240
lon_name=None,
238241
lat_name=None,
239242
area_name=None,
240-
minimum_depth=None,
243+
minimum_depth=0,
241244
masking_depth=None,
242245
):
243246
"""
@@ -330,7 +333,7 @@ def __init__(
330333
lon_name=None,
331334
lat_name=None,
332335
area_name=None,
333-
minimum_depth=None,
336+
minimum_depth=0,
334337
masking_depth=None,
335338
):
336339
"""
@@ -522,7 +525,7 @@ def main():
522525
parser.add_argument(
523526
"--minimum-depth",
524527
type=float,
525-
default=None,
528+
default=0,
526529
help=(
527530
"MINIMUM_DEPTH in metres. When a topography file is "
528531
"provided, any grid cell with depth <= MINIMUM_DEPTH is treated as land "

0 commit comments

Comments
 (0)