Skip to content

Commit

Permalink
Merge pull request #161 from NoraLoose/relax-kappa-constraint
Browse files Browse the repository at this point in the history
Relax constraint on kappa grid variable
  • Loading branch information
NoraLoose authored Sep 14, 2023
2 parents bb86bda + 64afc40 commit 8f4e36e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gcm_filters/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,12 @@ def __post_init__(self):
f"Please make sure all kappa_s are <=1."
)

if not (np.any(self.kappa_w == 1.0) or np.any(self.kappa_s == 1.0)):
if not (
np.any(np.isclose(self.kappa_w, 1.0, rtol=0, atol=1e-05))
or np.any(np.isclose(self.kappa_s, 1.0, rtol=0, atol=1e-05))
):
raise ValueError(
f"At least one place in the domain must have either kappa_w = 1.0 or kappa_s = 1."
f"At least one place in the domain must have either kappa_w = 1 or kappa_s = 1. "
f"Otherwise the filter's scale will not be equal to filter_scale anywhere in the domain."
)

Expand Down

0 comments on commit 8f4e36e

Please sign in to comment.