Skip to content

Commit

Permalink
Extended extract_relevant_gmfs
Browse files Browse the repository at this point in the history
  • Loading branch information
micheles committed Nov 9, 2023
1 parent 5228c0a commit b32e36a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openquake/calculators/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,10 @@ def get_relevant_event_ids(dstore, threshold):
if 'loss_by_event' not in dstore:
return
eids = dstore['loss_by_event/event_id'][:]
cumsum = dstore['loss_by_event/loss'][:].cumsum()
try:
cumsum = dstore['loss_by_event/loss'][:].cumsum()
except KeyError: # no losses
return eids
thr = threshold * cumsum[-1]
for i, csum in enumerate(cumsum, 1):
if csum > thr:
Expand Down

0 comments on commit b32e36a

Please sign in to comment.