diff --git a/include/evalhyd/detail/probabilist/ranks.hpp b/include/evalhyd/detail/probabilist/ranks.hpp index c841ec348e210bcb6201c594fb8ca65a55d3fa62..e21028521c7911305a2bd5f34f4012de86cfc434 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; } }