Skip to content

Commit

Permalink
Merge pull request #2905 from CliMA/zs/hotfix
Browse files Browse the repository at this point in the history
fix dividing by 0 in percentile_bounds_mean_norm
  • Loading branch information
szy21 authored Apr 15, 2024
2 parents e3d8c1b + 65d0912 commit 0180920
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/prognostic_equations/edmfx_boundary_condition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ function percentile_bounds_mean_norm(
gauss_int(x) = -exp(-x * x / 2) / sqrt(2 * pi)
xp_low = Distributions.quantile(Distributions.Normal(), low_percentile)
xp_high = Distributions.quantile(Distributions.Normal(), high_percentile)
return (gauss_int(xp_high) - gauss_int(xp_low)) / (
return (gauss_int(xp_high) - gauss_int(xp_low)) / max(
Distributions.cdf(Distributions.Normal(), xp_high) -
Distributions.cdf(Distributions.Normal(), xp_low)
Distributions.cdf(Distributions.Normal(), xp_low),
eps(FT),
)
end

0 comments on commit 0180920

Please sign in to comment.