Skip to content

Commit

Permalink
limit cos of zenith angle between -1 and 1 in ZenithAngleCalc.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 authored Jun 16, 2024
1 parent 6ba331b commit d04a636
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ZenithAngleCalc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function instantaneous_zenith_angle(
η = mod(η_UTC + λ, FT(2π))

# zenith angle, radians
θ = mod(acos(cos(ϕ) * cos(δ) * cos(η) + sin(ϕ) * sin(δ)), FT(2π))
θ = mod(acos(max(-FT(1), min(FT(1), cos(ϕ) * cos(δ) * cos(η) + sin(ϕ) * sin)))), FT(2π))

# solar azimuth angle, ζ = 0 when due E and increasing CCW
# ζ = 3π/2 (due S) when η=0 at local solar noon
Expand Down

0 comments on commit d04a636

Please sign in to comment.