diff --git a/tests/test_probabilist.cpp b/tests/test_probabilist.cpp index af4699de613857ea1bdb3463ed039bdd4e27fd83..2a6dba7805a9794e601155ff478cd8a47123048e 100644 --- a/tests/test_probabilist.cpp +++ b/tests/test_probabilist.cpp @@ -22,7 +22,7 @@ TEST(ProbabilistTests, TestBrier) ifs.close(); // compute scores - xt::xtensor<double, 2> thresholds = {{690, 534, 445}}; + xt::xtensor<double, 2> thresholds = {{690, 534, 445, NAN}}; std::vector<xt::xarray<double>> metrics = evalhyd::evalp( @@ -37,27 +37,41 @@ TEST(ProbabilistTests, TestBrier) // check results // Brier scores xt::xtensor<double, 4> bs = - {{{{0.10615136, 0.07395622, 0.08669186}}}}; - EXPECT_TRUE(xt::allclose(metrics[0], bs)); + {{{{0.10615136, 0.07395622, 0.08669186, NAN}}}}; + EXPECT_TRUE( + xt::sum(xt::isclose(metrics[0], bs, 1e-05, 1e-08, true)) + == xt::xscalar<double>(4) + ); // Brier skill scores xt::xtensor<double, 4> bss = - {{{{0.5705594, 0.6661165, 0.5635126}}}}; - EXPECT_TRUE(xt::allclose(metrics[1], bss)); + {{{{0.5705594, 0.6661165, 0.5635126, NAN}}}}; + EXPECT_TRUE( + xt::sum(xt::isclose(metrics[1], bss, 1e-05, 1e-08, true)) + == xt::xscalar<double>(4) + ); // Brier calibration-refinement decompositions xt::xtensor<double, 5> bs_crd = {{{{{0.011411758, 0.1524456, 0.2471852}, {0.005532413, 0.1530793, 0.2215031}, - {0.010139431, 0.1220601, 0.1986125}}}}}; - EXPECT_TRUE(xt::allclose(metrics[2], bs_crd)); + {0.010139431, 0.1220601, 0.1986125}, + {NAN, NAN, NAN}}}}}; + EXPECT_TRUE( + xt::sum(xt::isclose(metrics[2], bs_crd, 1e-05, 1e-08, true)) + == xt::xscalar<double>(12) + ); // Brier likelihood-base rate decompositions xt::xtensor<double, 5> bs_lbd = {{{{{0.012159881, 0.1506234, 0.2446149}, {0.008031746, 0.1473869, 0.2133114}, - {0.017191279, 0.1048221, 0.1743227}}}}}; - EXPECT_TRUE(xt::allclose(metrics[3], bs_lbd)); + {0.017191279, 0.1048221, 0.1743227}, + {NAN, NAN, NAN}}}}}; + EXPECT_TRUE( + xt::sum(xt::isclose(metrics[3], bs_lbd, 1e-05, 1e-08, true)) + == xt::xscalar<double>(12) + ); } TEST(ProbabilistTests, TestQuantiles)