Skip to content

Commit

Permalink
Simplify arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
sriharshakandala committed Nov 8, 2023
1 parent f11c7ec commit 491f4d3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/InsolationCalc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function solar_flux_and_cos_sza(
date0,
od,
param_set,
),
)...,
longitude,
latitude,
)
Expand Down
4 changes: 3 additions & 1 deletion src/ZenithAngleCalc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ and hour angle at longitude = 0.
"""
function instantaneous_zenith_angle(
(d, δ, η_UTC)::Tuple{FT, FT, FT},
d::FT,
δ::FT,
η_UTC::FT,
longitude::FT,
latitude::FT,
) where {FT}
Expand Down
6 changes: 3 additions & 3 deletions test/test_insolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ od = Insolation.OrbitalData()
date = Dates.DateTime(2020, 1, 1, 6, 0, 0)
lon, lat = [FT(0.0), FT(0.0)]
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -24,7 +24,7 @@ S, mu = solar_flux_and_cos_sza(date, date0, od, lon, lat, param_set)
date = Dates.DateTime(2020, 12, 20, 11, 0, 0)
lon, lat = [FT(0.0), FT(80.0)]
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -39,7 +39,7 @@ S, mu = solar_flux_and_cos_sza(date, date0, od, lon, lat, param_set)
# polar night NH 2
date = Dates.DateTime(2020, 12, 20, 23, 0, 0)
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand Down
8 changes: 4 additions & 4 deletions test/test_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ args = (
date0,
param_set,
eot_correction = false,
),
)...,
lon,
lat,
)
Expand All @@ -28,7 +28,7 @@ args = (
od,
param_set,
eot_correction = false,
),
)...,
lon,
lat,
)
Expand All @@ -46,7 +46,7 @@ args = (
date0,
param_set,
eot_correction = true,
),
)...,
lon,
lat,
)
Expand All @@ -65,7 +65,7 @@ args = (
od,
param_set,
eot_correction = true,
),
)...,
lon,
lat,
)
Expand Down
20 changes: 10 additions & 10 deletions test/test_zenith_angle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ od = Insolation.OrbitalData()
date = Dates.DateTime(2020, 2, 20, 6, 11, 0)
lon, lat = [FT(0.0), FT(0.0)]
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -15,7 +15,7 @@ sza, azi, d = instantaneous_zenith_angle(args...)
# solar noon at equator
date = Dates.DateTime(2020, 2, 20, 12, 14, 0)
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -25,7 +25,7 @@ sza, azi, d = instantaneous_zenith_angle(args...)
# sunset at equator
date = Dates.DateTime(2020, 2, 20, 18, 17, 0)
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -41,7 +41,7 @@ args = (
od,
param_set,
eot_correction = false,
),
)...,
lon,
lat,
)
Expand All @@ -57,7 +57,7 @@ args = (
od,
param_set,
eot_correction = false,
),
)...,
lon,
lat,
)
Expand All @@ -69,7 +69,7 @@ sza, azi, d = instantaneous_zenith_angle(args...)
date = Dates.DateTime(2020, 12, 20, 11, 0, 0)
lon, lat = [FT(0.0), FT(80.0)]
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -79,7 +79,7 @@ sza, azi, d = instantaneous_zenith_angle(args...)
# polar night NH 2
date = Dates.DateTime(2020, 12, 20, 23, 0, 0)
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -90,7 +90,7 @@ sza, azi, d = instantaneous_zenith_angle(args...)
date = Dates.DateTime(2020, 6, 20, 11, 0, 0)
lon, lat = [FT(0.0), FT(-80.0)]
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -100,7 +100,7 @@ sza, azi, d = instantaneous_zenith_angle(args...)
# polar night SH 2
date = Dates.DateTime(2020, 6, 20, 23, 0, 0)
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand All @@ -110,7 +110,7 @@ sza, azi, d = instantaneous_zenith_angle(args...)
## Test Distance
date = Dates.DateTime(2000, 3, 22, 0, 0, 0)
args = (
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set),
Insolation.helper_instantaneous_zenith_angle(date, date0, od, param_set)...,
lon,
lat,
)
Expand Down

0 comments on commit 491f4d3

Please sign in to comment.