Skip to content

Commit e33a5b3

Browse files
committed
Allow velocity model of all zeros as long as user-specified max_vel is non-zero
1 parent 94aa1e2 commit e33a5b3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/deepwave/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def set_max_vel(max_vel: Optional[float], max_abs_model_vel: float) -> float:
473473
"""Sets or validates the maximum velocity for the CFL condition.
474474
475475
Args:
476-
max_vel: The user-specified maximum velocity. If None, `max_model_vel`
476+
max_vel: The user-specified maximum velocity. If None, `max_abs_model_vel`
477477
is used.
478478
max_abs_model_vel: The maximum absolute velocity present in the model.
479479
@@ -494,11 +494,11 @@ def set_max_vel(max_vel: Optional[float], max_abs_model_vel: float) -> float:
494494
max_abs_model_vel = float(max_abs_model_vel)
495495
except (TypeError, ValueError) as e:
496496
raise TypeError("max_abs_model_vel must be convertible to a float.") from e
497-
if max_abs_model_vel <= 0:
498-
raise ValueError("max_abs_model_vel must be greater than zero.")
499497
if max_vel is None:
500498
return max_abs_model_vel
501499
max_vel = abs(max_vel)
500+
if max_vel <= 0:
501+
raise ValueError("maximum absolute velocity must be greater than zero.")
502502
if max_vel < max_abs_model_vel:
503503
warnings.warn("max_vel is less than the actual maximum velocity.", stacklevel=1)
504504
return max_vel

0 commit comments

Comments
 (0)