Skip to content

Commit 9ef9779

Browse files
committed
Fix bug in MTK test
1 parent aa12423 commit 9ef9779

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

test/test-mtk.jl

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ using CairoMakie
155155
# Test all conditions from each algorithm's test file
156156
conds = test_conditions()
157157

158-
@testset "$alg_name" for (alg_name, alg, exp_func, refr) in [
159-
("PSA", PSA(2020), expected_2020, NoRefraction()),
160-
("Walraven", Walraven(), expected_walraven, NoRefraction()),
161-
("USNO", USNO(), expected_usno, NoRefraction()),
162-
("NOAA", NOAA(), expected_noaa, HUGHES(101325.0, 10.0)),
163-
("SPA", SPA(), expected_spa, NoRefraction()),
158+
@testset "$alg_name" for (alg_name, alg, exp_func, refr, apparent) in [
159+
("PSA", PSA(2020), expected_2020, NoRefraction(), false),
160+
("Walraven", Walraven(), expected_walraven, NoRefraction(), false),
161+
("USNO", USNO(), expected_usno, NoRefraction(), false),
162+
("NOAA", NOAA(), expected_noaa, HUGHES(101325.0, 10.0), true),
163+
("SPA", SPA(), expected_spa, NoRefraction(), true),
164164
]
165165
# Get expected values for all test cases
166166
df_expected = exp_func()
@@ -175,12 +175,8 @@ using CairoMakie
175175
# astimezone converts to UTC, then DateTime extracts the DateTime part
176176
dt = DateTime(astimezone(zdt, tz"UTC"))
177177

178-
# Create observer
179-
if ismissing(alt)
180-
obs = Observer(lat, lon)
181-
else
182-
obs = Observer(lat, lon, altitude = alt)
183-
end
178+
obs =
179+
ismissing(alt) ? Observer(lat, lon) : Observer(lat, lon, altitude = alt)
184180

185181
@named sun = SolarPositionBlock()
186182
sys = mtkcompile(sun)
@@ -195,9 +191,7 @@ using CairoMakie
195191
prob = ODEProblem(sys, pmap, (0.0, 1.0))
196192
sol = solve(prob; saveat = [0.0])
197193

198-
# For algorithms with refraction or SPA, use apparent_elevation/apparent_zenith
199-
# Otherwise use elevation/zenith
200-
if haskey(row, :apparent_elevation)
194+
if apparent
201195
@test isapprox(
202196
sol[sys.elevation][1],
203197
row.apparent_elevation,

0 commit comments

Comments
 (0)