From b556eeea450d43c0d0c261af03ba8f1acea20a72 Mon Sep 17 00:00:00 2001
From: Thibault Hallouin <thibault.hallouin@inrae.fr>
Date: Thu, 23 Mar 2023 12:13:00 +0100
Subject: [PATCH] add min and max in quantiles used for thresholds in
 CRPS_FROM_BS

---
 include/evalhyd/detail/probabilist/brier.hpp | 8 +++++---
 tests/expected/evalp/CRPS_FROM_BS.csv        | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/evalhyd/detail/probabilist/brier.hpp b/include/evalhyd/detail/probabilist/brier.hpp
index 13226de..387a773 100644
--- a/include/evalhyd/detail/probabilist/brier.hpp
+++ b/include/evalhyd/detail/probabilist/brier.hpp
@@ -895,7 +895,9 @@ namespace evalhyd
             }
 
             /// Compute the continuous rank probability score based on the
-            /// integration over the Brier scores (CRPS_FROM_BS).
+            /// integration over 101 Brier scores (CRPS_FROM_BS), i.e. using the
+            /// observed minimum, the 99 observed percentiles, and the observed
+            /// maximum as the exceedance thresholds.
             ///
             /// \param q_obs
             ///     Streamflow observations.
@@ -966,7 +968,7 @@ namespace evalhyd
                         {
                             // compute empirical thresholds from 99 observed quantiles
                             xt::xtensor<double, 2> thr =
-                                    xt::zeros<double>({n_sit, std::size_t {99}});
+                                    xt::zeros<double>({n_sit, std::size_t {101}});
 
                             // /!\ need to compute quantiles one site at a time
                             //     because there is no `xt::nanquantile`, so
@@ -983,7 +985,7 @@ namespace evalhyd
                                 {
                                     xt::view(thr, s, xt::all()) = xt::quantile(
                                             obs_filtered,
-                                            xt::arange<double>(0.01, 1.0, 0.01)
+                                            xt::arange<double>(0.00, 1.01, 0.01)
                                     );
                                 }
                                 else
diff --git a/tests/expected/evalp/CRPS_FROM_BS.csv b/tests/expected/evalp/CRPS_FROM_BS.csv
index 03c315f..7a15540 100644
--- a/tests/expected/evalp/CRPS_FROM_BS.csv
+++ b/tests/expected/evalp/CRPS_FROM_BS.csv
@@ -1 +1 @@
-221.3421266369226
+226.5713674310274
-- 
GitLab