Skip to content

Commit 0180920

Browse files
authored
Merge pull request #2905 from CliMA/zs/hotfix
fix dividing by 0 in percentile_bounds_mean_norm
2 parents e3d8c1b + 65d0912 commit 0180920

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/prognostic_equations/edmfx_boundary_condition.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ function percentile_bounds_mean_norm(
5656
gauss_int(x) = -exp(-x * x / 2) / sqrt(2 * pi)
5757
xp_low = Distributions.quantile(Distributions.Normal(), low_percentile)
5858
xp_high = Distributions.quantile(Distributions.Normal(), high_percentile)
59-
return (gauss_int(xp_high) - gauss_int(xp_low)) / (
59+
return (gauss_int(xp_high) - gauss_int(xp_low)) / max(
6060
Distributions.cdf(Distributions.Normal(), xp_high) -
61-
Distributions.cdf(Distributions.Normal(), xp_low)
61+
Distributions.cdf(Distributions.Normal(), xp_low),
62+
eps(FT),
6263
)
6364
end

0 commit comments

Comments
 (0)