Skip to content

Commit

Permalink
Merge pull request #932 from CliMA/zs/leaderboard
Browse files Browse the repository at this point in the history
use linear interpolation in leaderboard
  • Loading branch information
szy21 authored Aug 21, 2024
2 parents 507e1d8 + 081a11d commit 0246263
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions experiments/ClimaEarth/run_amip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ if ClimaComms.iamroot(comms_ctx)
"pr" => (-5.0, 5.0),
"rsut" => (-50.0, 50.0),
"rlut" => (-50.0, 50.0),
"rsdt" => (-10.0, 10.0),
"rsdt" => (-2.0, 2.0),
"rsutcs" => (-20.0, 20.0),
"rlutcs" => (-20.0, 20.0),
)
Expand All @@ -957,7 +957,8 @@ if ClimaComms.iamroot(comms_ctx)
diagnostics_times = ClimaAnalysis.times(first_var)
# Remove the first `spinup_months` months from the leaderboard
spinup_months = 6
spinup_cutoff = spinup_months * 30 * 86400.0
# The monthly average output is at the end of the month, so this is safe
spinup_cutoff = spinup_months * 31 * 86400.0
if diagnostics_times[end] > spinup_cutoff
filter!(x -> x > spinup_cutoff, diagnostics_times)
end
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/user_io/leaderboard/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function resample(
vec_to_range(v) = range(v[begin], v[end], length = length(v))
src_lonlat_ranges = vec_to_range.(src_lonlat)

itp = Interpolations.constant_interpolation(
itp = Interpolations.linear_interpolation(
src_lonlat_ranges,
data,
extrapolation_bc = (Interpolations.Periodic(), Interpolations.Flat()),
Expand Down
2 changes: 1 addition & 1 deletion test/experiment_tests/leaderboard.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include(joinpath(pkgdir(ClimaCoupler), "artifacts", "artifact_funcs.jl"))

input_matrix = reshape(1.0:16, (4, 4))

@test Leaderboard.resample(input_matrix, (1.0:4, 1.0:4), ([2.8], [3.7]))[1] == 15.0
@test Leaderboard.resample(input_matrix, (1.0:4, 1.0:4), ([2.8], [3.7]))[1] == 13.6

@test_throws ErrorException Leaderboard.integration_weights(([1.0], [10.0]))
@test_throws ErrorException Leaderboard.integration_weights(([10.0], [1.0]))
Expand Down

0 comments on commit 0246263

Please sign in to comment.