Skip to content

Commit

Permalink
Add a unit test on Hazard.get_mdr method
Browse files Browse the repository at this point in the history
  • Loading branch information
bguillod committed Sep 17, 2024
1 parent e8dc59b commit 6363585
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions climada/hazard/test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,14 @@ def test_get_mdr(self):
true_mdr = np.digitize(haz.intensity[:, idx].toarray(), [0, 1])
np.testing.assert_array_almost_equal(mdr.toarray(), true_mdr)

# #case with zeros everywhere
cent_idx = np.array([0, 0, 1])
impf.mdd=np.array([0,0,0,1])
# how many non-zeros values are expected
num_nz_values = 5
mdr = haz.get_mdr(cent_idx, impf)
self.assertEqual(mdr.nnz, num_nz_values)

def test_get_paa(self):
haz = dummy_hazard()
impf = dummy_step_impf(haz)
Expand Down

0 comments on commit 6363585

Please sign in to comment.