From 7951c383594114dcc8581e3531d521707cdea440 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Mon, 10 Jun 2024 09:02:20 -0700 Subject: [PATCH] Add boxes in bias_leaderboard --- .../user_io/leaderboard/cmip_rmse.jl | 22 ++++++++++- .../user_io/leaderboard/compare_with_obs.jl | 38 +++++++++++++------ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/experiments/ClimaEarth/user_io/leaderboard/cmip_rmse.jl b/experiments/ClimaEarth/user_io/leaderboard/cmip_rmse.jl index 71dc462a20..af5159f8b8 100644 --- a/experiments/ClimaEarth/user_io/leaderboard/cmip_rmse.jl +++ b/experiments/ClimaEarth/user_io/leaderboard/cmip_rmse.jl @@ -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") @@ -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"]) diff --git a/experiments/ClimaEarth/user_io/leaderboard/compare_with_obs.jl b/experiments/ClimaEarth/user_io/leaderboard/compare_with_obs.jl index a5d0e740ea..6cbe1c6bdc 100644 --- a/experiments/ClimaEarth/user_io/leaderboard/compare_with_obs.jl +++ b/experiments/ClimaEarth/user_io/leaderboard/compare_with_obs.jl @@ -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)