diff --git a/deps/evalhyd b/deps/evalhyd index 90924065cc6365f65e3b33214884eb352a01e913..0cb58bb553733c00eed1930b62b7636899819b54 160000 --- a/deps/evalhyd +++ b/deps/evalhyd @@ -1 +1 @@ -Subproject commit 90924065cc6365f65e3b33214884eb352a01e913 +Subproject commit 0cb58bb553733c00eed1930b62b7636899819b54 diff --git a/src/evalhyd-python.cpp b/src/evalhyd-python.cpp index 1c2c2f7bed64858af3ef97bb8098cb63855188e0..9635b12800989f6735251098a71fed4e87603b01 100644 --- a/src/evalhyd-python.cpp +++ b/src/evalhyd-python.cpp @@ -158,10 +158,6 @@ PYBIND11_MODULE(evalhyd, m) ); // probabilistic evaluation - py::list empty_1d; - py::list empty_2d; - empty_2d.append(py::list()); - m.def( "evalp", evalhyd::evalp, R"pbdoc( @@ -204,7 +200,8 @@ PYBIND11_MODULE(evalhyd, m) shape: [(sites, lead times, subsets, {quantiles,} {thresholds,} {components}), ...] )pbdoc", py::arg("q_obs"), py::arg("q_prd"), py::arg("metrics"), - py::arg("q_thr") = empty_1d, py::arg("t_msk") = empty_2d + py::arg("q_thr") = xt::pytensor<double, 2>({0}), + py::arg("t_msk") = xt::pytensor<bool, 3>({0}) ); #ifdef VERSION_INFO diff --git a/tests/test_probabilist.py b/tests/test_probabilist.py index 2f0b62aebdb872cfb30e09f7b8562d4a79fbf8f8..89c257109ac152ee8368d39d38840021a929c8cb 100644 --- a/tests/test_probabilist.py +++ b/tests/test_probabilist.py @@ -38,7 +38,7 @@ class TestMetrics(unittest.TestCase): } def test_threshold_metrics(self): - thr = [690, 534, 445] + thr = numpy.array([[690, 534, 445]]) for metric in self.expected_thr.keys(): with self.subTest(metric=metric): numpy.testing.assert_almost_equal( @@ -58,7 +58,7 @@ class TestMetrics(unittest.TestCase): class TestDecomposition(unittest.TestCase): def test_brier_calibration_refinement(self): - thr = [690, 534, 445] + thr = numpy.array([[690, 534, 445]]) bs, = evalhyd.evalp(_obs, _prd, ["BS"], thr) bs_crd, = evalhyd.evalp(_obs, _prd, ["BS_CRD"], thr) numpy.testing.assert_almost_equal( @@ -66,7 +66,7 @@ class TestDecomposition(unittest.TestCase): ) def test_brier_likelihood_base_rate(self): - thr = [690, 534, 445] + thr = numpy.array([[690, 534, 445]]) bs, = evalhyd.evalp(_obs, _prd, ["BS"], thr) bs_lbd, = evalhyd.evalp(_obs, _prd, ["BS_LBD"], thr) numpy.testing.assert_almost_equal( @@ -77,8 +77,8 @@ class TestDecomposition(unittest.TestCase): class TestMasking(unittest.TestCase): def test_masks(self): - msk = numpy.ones(_obs.shape, dtype=bool) - msk[:, :99] = False + msk = numpy.ones((1, *_obs.shape), dtype=bool) + msk[..., :99] = False numpy.testing.assert_almost_equal( evalhyd.evalp(_obs, _prd, ["QS"], t_msk=msk)[0], evalhyd.evalp(_obs[..., 99:], _prd[..., 99:], ["QS"])[0]