Commit 1a813405 authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

update to latest evalhyd version

version which adds "sites" axis to dimensions of thresholds and masks
No related merge requests found
Pipeline #38401 passed with stage
in 1 minute and 44 seconds
Showing with 8 additions and 11 deletions
+8 -11
Subproject commit 90924065cc6365f65e3b33214884eb352a01e913
Subproject commit 0cb58bb553733c00eed1930b62b7636899819b54
......@@ -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
......
......@@ -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]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment