Skip to content

Commit 4b7de71

Browse files
authored
Merge pull request #9077 from gem/weig
Finally fixed the AELO tests
2 parents c41b00b + b0adc94 commit 4b7de71

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

openquake/calculators/postproc/compute_rtgm.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ def main(dstore, csm):
333333
if not rtgmpy:
334334
logging.warning('Missing module rtgmpy: skipping AELO calculation')
335335
return
336+
if dstore['mean_rates_ss'][:].max() < 1E-3:
337+
logging.warning('Ultra-low hazard: skipping AELO calculation')
338+
return
336339
logging.info('Computing Risk Targeted Ground Motion')
337340
oq = dstore['oqparam']
338341
stats = list(oq.hazard_stats())

openquake/calculators/postproc/disagg_by_rel_sources.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
from openquake.calculators import extract
2828

2929

30-
def get_mag_dist_eps_df(
31-
mean_disagg_by_src, src_mutex, src_info):
30+
def get_mag_dist_eps_df(mean_disagg_by_src, src_mutex, src_info):
3231
"""
3332
Compute mag, dist, eps, sig for each (src, imt) combination.
3433
@@ -47,9 +46,12 @@ def get_mag_dist_eps_df(
4746
grp[src] = grp_id
4847
for s, src in enumerate(mean_disagg_by_src.source_id):
4948
for m, imt in enumerate(mean_disagg_by_src.imt):
50-
rates_mag = mean_disagg_by_src[s, :, :, :, m].sum((1, 2))
51-
rates_dst = mean_disagg_by_src[s, :, :, :, m].sum((0, 2))
52-
rates_eps = mean_disagg_by_src[s, :, :, :, m].sum((0, 1))
49+
rates = mean_disagg_by_src[s, :, :, :, m]
50+
if (rates == 0).all():
51+
continue # no contribution from this imt
52+
rates_mag = rates.sum((1, 2))
53+
rates_dst = rates.sum((0, 2))
54+
rates_eps = rates.sum((0, 1))
5355
dic['src'].append(src)
5456
dic['imt'].append(imt)
5557
# NB: 0=mag, 1=dist, 2=eps are the dimensions of the array

0 commit comments

Comments
 (0)