Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add downward sw fluxes to leaderboard #927

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading