diff --git a/include/evalhyd/detail/probabilist/evaluator.hpp b/include/evalhyd/detail/probabilist/evaluator.hpp index e39756fdecd371cda29fb0b097d8e12180131271..7c3967e3ac55e973db5f4127f76830dc3cea3d3c 100644 --- a/include/evalhyd/detail/probabilist/evaluator.hpp +++ b/include/evalhyd/detail/probabilist/evaluator.hpp @@ -104,7 +104,7 @@ namespace evalhyd xtl::xoptional<xt::xtensor<double, 6>, bool> CSI; xtl::xoptional<xt::xtensor<double, 5>, bool> ROCSS; // > Ranks-based - xtl::xoptional<xt::xtensor<double, 5>, bool> RANK_DIAG; + xtl::xoptional<xt::xtensor<double, 5>, bool> RANK_HIST; xtl::xoptional<xt::xtensor<double, 4>, bool> DS; xtl::xoptional<xt::xtensor<double, 4>, bool> AS; // > Intervals-based @@ -640,16 +640,16 @@ namespace evalhyd return ROCSS.value(); }; - xt::xtensor<double, 5> get_RANK_DIAG() + xt::xtensor<double, 5> get_RANK_HIST() { - if (!RANK_DIAG.has_value()) + if (!RANK_HIST.has_value()) { - RANK_DIAG = metrics::calc_RANK_DIAG( + RANK_HIST = metrics::calc_RANK_HIST( get_o_j(), t_msk, b_exp, n_sit, n_ldt, n_mbr, n_msk, n_exp ); } - return RANK_DIAG.value(); + return RANK_HIST.value(); }; xt::xtensor<double, 4> get_DS() diff --git a/include/evalhyd/detail/probabilist/ranks.hpp b/include/evalhyd/detail/probabilist/ranks.hpp index 02082338ee6e983a492e97d293f520de227a0b8f..4e2a898719715479afe2b1c570b157b4ceec210a 100644 --- a/include/evalhyd/detail/probabilist/ranks.hpp +++ b/include/evalhyd/detail/probabilist/ranks.hpp @@ -189,7 +189,8 @@ namespace evalhyd namespace metrics { - /// Compute the rank diagram, also known as Talagrand diagram. + /// Compute the frequencies of the rank histogram, also known as + /// Talagrand diagram. /// /// \param o_j /// Tallies of streamflow observations for all possible ranks. @@ -211,9 +212,9 @@ namespace evalhyd /// \param n_exp /// Number of bootstrap samples. /// \return - /// Rank diagram. + /// Frequencies of the rank histogram. /// shape: (sites, lead times, subsets, samples, ranks) - inline xt::xtensor<double, 5> calc_RANK_DIAG( + inline xt::xtensor<double, 5> calc_RANK_HIST( const xt::xtensor<double, 5>& o_j, const xt::xtensor<bool, 4>& t_msk, const std::vector<xt::xkeep_slice<int>>& b_exp, diff --git a/include/evalhyd/evalp.hpp b/include/evalhyd/evalp.hpp index 0aff6f6392a1254a455d0f6203d78119801ece49..83ca0621b2ad7ce45ffbd814e3c693cf8c8d9902 100644 --- a/include/evalhyd/evalp.hpp +++ b/include/evalhyd/evalp.hpp @@ -212,7 +212,7 @@ namespace evalhyd {"BS", "BSS", "BS_CRD", "BS_LBD", "QS", "CRPS", "POD", "POFD", "FAR", "CSI", "ROCSS", - "RANK_DIAG", "DS", "AS", + "RANK_HIST", "DS", "AS", "CR", "AW", "AWN", "AWI", "WS", "WSS"} ); @@ -457,10 +457,10 @@ namespace evalhyd uncertainty::summarise(evaluator.get_ROCSS(), summary) ); } - else if ( metric == "RANK_DIAG" ) + else if ( metric == "RANK_HIST" ) { r.emplace_back( - uncertainty::summarise(evaluator.get_RANK_DIAG(), summary) + uncertainty::summarise(evaluator.get_RANK_HIST(), summary) ); } else if ( metric == "DS" ) diff --git a/tests/test_probabilist.cpp b/tests/test_probabilist.cpp index 1e15bf9c372c1320004af1bf60e3aee1086dde04..f0449b75957e32630f214fb073c74eb7ddae2fbc 100644 --- a/tests/test_probabilist.cpp +++ b/tests/test_probabilist.cpp @@ -29,7 +29,7 @@ std::vector<std::string> all_metrics_p = { "BS", "BSS", "BS_CRD", "BS_LBD", "QS", "CRPS", "POD", "POFD", "FAR", "CSI", "ROCSS", - "RANK_DIAG", "DS", "AS", + "RANK_HIST", "DS", "AS", "CR", "AW", "AWN", "AWI", "WS", "WSS" }; @@ -421,7 +421,7 @@ TEST(ProbabilistTests, TestRanks) xt::eval(xt::view(observed, xt::newaxis(), xt::all())), // shape: (sites [1], lead times [1], members [m], time [t]) xt::eval(xt::view(predicted, xt::newaxis(), xt::newaxis(), xt::all(), xt::all())), - {"RANK_DIAG", "DS", "AS"}, + {"RANK_HIST", "DS", "AS"}, xt::xtensor<double, 2>({}), "high", // events {}, // c_lvl @@ -433,10 +433,10 @@ TEST(ProbabilistTests, TestRanks) ); // check results - // Rank diagram - xt::xtensor<double, 5> rank_diag; + // Rank histogram + xt::xtensor<double, 5> rank_hist; #if EVALHYD_TESTING_OS == WINDOWS - rank_diag = {{{{{ 0.607717, 0. , 0. , 0. , 0. , 0.003215, + rank_hist = {{{{{ 0.607717, 0. , 0. , 0. , 0. , 0.003215, 0. , 0. , 0. , 0. , 0. , 0. , 0.003215, 0. , 0.003215, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , @@ -446,7 +446,7 @@ TEST(ProbabilistTests, TestRanks) 0. , 0.003215, 0. , 0. , 0.003215, 0.003215, 0.003215, 0. , 0.006431, 0.344051}}}}}; #elif EVALHYD_TESTING_OS == MACOS - rank_diag = {{{{{ 0.607717, 0. , 0. , 0. , 0. , 0.003215, + rank_hist = {{{{{ 0.607717, 0. , 0. , 0. , 0. , 0.003215, 0. , 0. , 0. , 0. , 0. , 0. , 0.003215, 0. , 0.003215, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , @@ -456,7 +456,7 @@ TEST(ProbabilistTests, TestRanks) 0. , 0.003215, 0. , 0. , 0.003215, 0.003215, 0.003215, 0. , 0.006431, 0.344051}}}}}; #elif EVALHYD_TESTING_OS == LINUX - rank_diag = {{{{{ 0.607717, 0. , 0. , 0. , 0. , 0.003215, + rank_hist = {{{{{ 0.607717, 0. , 0. , 0. , 0. , 0.003215, 0. , 0. , 0. , 0. , 0. , 0. , 0.003215, 0. , 0.003215, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , @@ -467,7 +467,7 @@ TEST(ProbabilistTests, TestRanks) 0.003215, 0. , 0.006431, 0.344051}}}}}; #endif EXPECT_TRUE( - xt::all(xt::isclose(metrics[0], rank_diag, 1e-04, 1e-06, true)) + xt::all(xt::isclose(metrics[0], rank_hist, 1e-04, 1e-06, true)) ); // Delta scores @@ -597,7 +597,7 @@ TEST(ProbabilistTests, TestMasks) // lengths are different between "masked" and "subset", which // results in different tensor shapes, and hence in different // random ranks for ties - if ((all_metrics_p[m] == "RANK_DIAG") + if ((all_metrics_p[m] == "RANK_HIST") || (all_metrics_p[m] == "DS") || (all_metrics_p[m] == "AS")) { @@ -665,7 +665,7 @@ TEST(ProbabilistTests, TestMaskingConditions) // lengths are different between "conditioned" and "preconditioned", // which results in different tensor shapes, and hence in different // random ranks for ties - if ((all_metrics_p[m] == "RANK_DIAG") + if ((all_metrics_p[m] == "RANK_HIST") || (all_metrics_p[m] == "DS") || (all_metrics_p[m] == "AS")) { @@ -722,7 +722,7 @@ TEST(ProbabilistTests, TestMaskingConditions) // lengths are different between "conditioned" and "preconditioned", // which results in different tensor shapes, and hence in different // random ranks for ties - if ((all_metrics_p[m] == "RANK_DIAG") + if ((all_metrics_p[m] == "RANK_HIST") || (all_metrics_p[m] == "DS") || (all_metrics_p[m] == "AS")) { @@ -776,7 +776,7 @@ TEST(ProbabilistTests, TestMaskingConditions) // lengths are different between "conditioned" and "subset", // which results in different tensor shapes, and hence in different // random ranks for ties - if ((all_metrics_p[m] == "RANK_DIAG") + if ((all_metrics_p[m] == "RANK_HIST") || (all_metrics_p[m] == "DS") || (all_metrics_p[m] == "AS")) { @@ -951,7 +951,7 @@ TEST(ProbabilistTests, TestBootstrap) // lengths are different between "bts" and "rep", which // results in different tensor shapes, and hence in different // random ranks for ties - if ((all_metrics_p[m] == "RANK_DIAG") + if ((all_metrics_p[m] == "RANK_HIST") || (all_metrics_p[m] == "DS") || (all_metrics_p[m] == "AS")) {