Commit f7b3523e authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

add unit test for conditional masking on time indices

1 merge request!1release v0.1.0.0
Pipeline #43996 passed with stage
in 3 minutes and 49 seconds
Showing with 30 additions and 0 deletions
+30 -0
...@@ -140,6 +140,23 @@ class TestMasking(unittest.TestCase): ...@@ -140,6 +140,23 @@ class TestMasking(unittest.TestCase):
evalhyd.evald(obs, prd, ["NSE"])[0] evalhyd.evald(obs, prd, ["NSE"])[0]
) )
with self.subTest(conditions="time indices"):
cdt = numpy.array([["t{20:311}"],
["t{20:100,100:311}"],
["t{20,21,22,23,24:311}"],
["t{20,21,22,23:309,309,310}"],
["t{20:80,80,81,82,83:311}"]],
dtype='|S32')
# TODO: figure out why passing views would not work
obs = _obs[..., 20:].copy()
prd = _prd[..., 20:].copy()
numpy.testing.assert_almost_equal(
evalhyd.evald(_obs, _prd, ["NSE"], m_cdt=cdt)[0],
evalhyd.evald(obs, prd, ["NSE"])[0]
)
class TestMissingData(unittest.TestCase): class TestMissingData(unittest.TestCase):
......
...@@ -205,6 +205,19 @@ class TestMasking(unittest.TestCase): ...@@ -205,6 +205,19 @@ class TestMasking(unittest.TestCase):
evalhyd.evalp(obs, prd, ["QS"])[0] evalhyd.evalp(obs, prd, ["QS"])[0]
) )
with self.subTest(conditions="time indices"):
cdt = numpy.array([["t{20:80,80,81,82,83:311}"]],
dtype='|S32')
# TODO: figure out why passing views would not work
obs = _obs[..., 20:].copy()
prd = _prd[..., 20:].copy()
numpy.testing.assert_almost_equal(
evalhyd.evalp(_obs, _prd, ["QS"], m_cdt=cdt)[0],
evalhyd.evalp(obs, prd, ["QS"])[0]
)
class TestMissingData(unittest.TestCase): class TestMissingData(unittest.TestCase):
......
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