Skip to content

Commit

Permalink
Add boxes in bias_leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Sbozzolo committed Jun 10, 2024
1 parent c0f9d8b commit 7951c38
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
22 changes: 20 additions & 2 deletions experiments/ClimaEarth/user_io/leaderboard/cmip_rmse.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Statistics: median
import Statistics: median, quantile

pr_file_path = joinpath(@clima_artifact("cmip_model_rmse"), "pr_rmse_amip_pr_amip_5yr.csv")

Expand Down Expand Up @@ -68,7 +68,25 @@ function RSME_stats(vecRMSEs)
SON = minimum(abs.(SON)),
)

(; best_single_model = best_single_model(vecRMSEs), median_model, worst_model, best_model)
quantile25 = RMSEs(;
model_name = "Quantile 0.25",
ANN = quantile(ANN, 0.25),
DJF = quantile(DJF, 0.25),
JJA = quantile(JJA, 0.25),
MAM = quantile(MAM, 0.25),
SON = quantile(SON, 0.25),
)

quantile75 = RMSEs(;
model_name = "Quantile 0.75",
ANN = quantile(ANN, 0.75),
DJF = quantile(DJF, 0.75),
JJA = quantile(JJA, 0.75),
MAM = quantile(MAM, 0.75),
SON = quantile(SON, 0.75),
)

(; best_single_model = best_single_model(vecRMSEs), median_model, worst_model, best_model, quantile25, quantile75)
end

COMPARISON_RMSEs["pr"] = RSME_stats(OTHER_MODELS_RMSEs["pr"])
38 changes: 27 additions & 11 deletions experiments/ClimaEarth/user_io/leaderboard/compare_with_obs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,42 @@ function plot_leaderboard(rmses; output_path)
squares[begin:NUM_BOXES, var_num] .= values(rmse) ./ values(median_model)
squares[(NUM_BOXES + 1):end, var_num] .= values(best_single_model) ./ values(median_model)

CairoMakie.errorbars!(
CairoMakie.scatter!(
ax,
1:5,
values(median_model),
values(best_model),
values(worst_model),
whiskerwidth = 10,
label = median_model.model_name,
color = :black,
linewidth = 0.5,
marker = :hline,
markersize = 15,
)

categories = vcat(map(_ -> collect(1:5), 1:length(OTHER_MODELS_RMSEs[short_name]))...)

CairoMakie.boxplot!(
ax,
categories,
vcat(values.(OTHER_MODELS_RMSEs[short_name])...);
whiskerwidth = 1,
width = 0.35,
mediancolor = :black,
color = :gray,
whiskerlinewidth = 1,
)

for model in OTHER_MODELS_RMSEs[short_name]
CairoMakie.scatter!(ax, 1:5, values(model), marker = :hline)
end

CairoMakie.scatter!(
ax,
1:5,
values(median_model),
label = median_model.model_name,
color = :black,
marker = :hline,
values(rmse),
label = rmse.model_name,
marker = :star5,
markersize = 20,
color = :orange,
)
CairoMakie.scatter!(ax, 1:5, values(best_single_model), label = best_single_model.model_name)
CairoMakie.scatter!(ax, 1:5, values(rmse), label = rmse.model_name, marker = :star5)

# Add a fake extra point to center the legend a little better
CairoMakie.scatter!(ax, [6.5], [0.1], markersize = 0.01)
Expand Down

0 comments on commit 7951c38

Please sign in to comment.