Skip to content

Commit

Permalink
Merge pull request #927 from CliMA/zs/leaderboard
Browse files Browse the repository at this point in the history
add downward sw fluxes to leaderboard
  • Loading branch information
Sbozzolo committed Aug 15, 2024
2 parents ff886cd + 615b067 commit f3c6840
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion experiments/ClimaEarth/run_amip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,13 @@ if ClimaComms.iamroot(comms_ctx)
include("user_io/leaderboard.jl")
ClimaAnalysis = Leaderboard.ClimaAnalysis

compare_vars_biases = ["pr", "rsut", "rlut", "rsutcs", "rlutcs"]
compare_vars_biases = ["pr", "rsut", "rlut", "rsdt", "rsutcs", "rlutcs"]

compare_vars_biases_plot_extrema = Dict(
"pr" => (-5.0, 5.0),
"rsut" => (-50.0, 50.0),
"rlut" => (-50.0, 50.0),
"rsdt" => (-10.0, 10.0),
"rsutcs" => (-20.0, 20.0),
"rlutcs" => (-20.0, 20.0),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ OBS_DS["rsutcs"] = ObsDataSource(;
)
SIM_DS_KWARGS["rsutcs"] = (;)

OBS_DS["rsdt"] = ObsDataSource(;
path = joinpath(@clima_artifact("radiation_obs"), "CERES_EBAF-TOA_Ed4.2_Subset_200003-202303.g025.nc"),
var_name = "solar_mon",
)
SIM_DS_KWARGS["rsdt"] = (;)

OBS_DS["rlutcs"] = ObsDataSource(;
path = joinpath(@clima_artifact("radiation_obs"), "CERES_EBAF-TOA_Ed4.2_Subset_200003-202303.g025.nc"),
var_name = "toa_lw_clr_c_mon",
Expand Down
15 changes: 14 additions & 1 deletion experiments/ClimaEarth/user_io/leaderboard/data_sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ struct ObsDataSource

"""The NCDataset associated to the file"""
ncdataset::NCDatasets.NCDataset

"""Shift dates so that they are at the end of month?"""
shift_to_end_of_month::Bool
end

function ObsDataSource(;
Expand All @@ -33,11 +36,21 @@ function ObsDataSource(;
lon_name = "lon",
lat_name = "lat",
preprocess_data_fn = identity,
shift_to_end_of_month = true,
)

ncdataset = NCDatasets.NCDataset(path)

return ObsDataSource(path, var_name, time_name, lon_name, lat_name, preprocess_data_fn, ncdataset)
return ObsDataSource(
path,
var_name,
time_name,
lon_name,
lat_name,
preprocess_data_fn,
ncdataset,
shift_to_end_of_month,
)
end

"""
Expand Down
4 changes: 4 additions & 0 deletions experiments/ClimaEarth/user_io/leaderboard/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ function find_and_resample(

available_times = obs.ncdataset[observed_data.time_name]

if observed_data.shift_to_end_of_month
available_times = Dates.DateTime.(Dates.lastdayofmonth.(available_times))
end

time_index = ClimaAnalysis.Utils.nearest_index(available_times, date)

# NOTE: We are hardcoding that the time index is the last one and that there are three
Expand Down

0 comments on commit f3c6840

Please sign in to comment.