From 26966b079fab2c790c03d7a319a5bd63836eb489 Mon Sep 17 00:00:00 2001 From: Thibault Hallouin <thibault.hallouin@inrae.fr> Date: Sat, 21 Jan 2023 12:04:29 +0100 Subject: [PATCH] fix the order of the X and Y axes in REL_DIAG --- include/evalhyd/detail/probabilist/ranks.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/evalhyd/detail/probabilist/ranks.hpp b/include/evalhyd/detail/probabilist/ranks.hpp index c841ec3..e210285 100644 --- a/include/evalhyd/detail/probabilist/ranks.hpp +++ b/include/evalhyd/detail/probabilist/ranks.hpp @@ -184,7 +184,8 @@ namespace evalhyd namespace metrics { - /// Compute the reliability diagram X and Y axes. + /// Compute the reliability diagram X and Y axes, the forecast + /// probability and the observed relative frequency, respectively. /// /// \param o_j /// Tallies of streamflow observations for all possible ranks. @@ -238,19 +239,21 @@ namespace evalhyd // calculate length of subset auto l = xt::sum(t_msk_sampled, -1); + // compute the forecast probability $y_i$ + // [X-axis] + xt::view(REL_DIAG, xt::all(), xt::all(), m, e, xt::all(), 0) = + xt::arange<double>(double(n_mbr + 1)) / n_mbr; + // compute the observed relative frequency + // [Y-axis] // $\bar{o_j} = \frac{1}{n} \sum_{k \in M_j} r_k$ - xt::view(REL_DIAG, xt::all(), xt::all(), m, e, xt::all(), 0) = + xt::view(REL_DIAG, xt::all(), xt::all(), m, e, xt::all(), 1) = xt::cumsum( xt::view(o_j, xt::all(), xt::all(), m, e, xt::all()) / l, -1 ); - - // compute the forecast probability $y_i$ - xt::view(REL_DIAG, xt::all(), xt::all(), m, e, xt::all(), 1) = - xt::arange<double>(double(n_mbr + 1)) / n_mbr; } } -- GitLab