Skip to content

Commit

Permalink
Merge pull request #10076 from gem/risk_by_event
Browse files Browse the repository at this point in the history
Added test for risk_by_event from event_based_damage
  • Loading branch information
micheles authored Oct 22, 2024
2 parents 6fb79bd + eb0882e commit 1ff0758
Show file tree
Hide file tree
Showing 3 changed files with 314 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openquake/calculators/event_based_damage.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def _dframe(adic, csqidx, loss_types):
dic['agg_id'].append(kid)
dic['event_id'].append(eid)
dic['loss_id'].append(scientific.LOSSID[lt])
for sname, si in csqidx.items():
dic[sname].append(dd[li, si])
for cname, ci in csqidx.items():
dic[cname].append(dd[li, ci])
fix_dtypes(dic)
return pandas.DataFrame(dic)

Expand Down
4 changes: 4 additions & 0 deletions openquake/calculators/tests/event_based_damage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,7 @@ def test_case_15(self):
self.assertEqual(
list(dic),
['rlz-000', 'rlz-001', 'rlz-002', 'rlz-003', 'rlz-004', 'extra'])

# check risk_by_event
[f] = export(('risk_by_event', 'csv'), self.calc.datastore)
self.assertEqualFiles('expected/' + strip_calc_id(f), f, delta=5E-5)
Loading

0 comments on commit 1ff0758

Please sign in to comment.