Skip to content

Commit

Permalink
Merge pull request #9077 from gem/weig
Browse files Browse the repository at this point in the history
Finally fixed the AELO tests
  • Loading branch information
micheles committed Oct 6, 2023
2 parents c41b00b + b0adc94 commit 4b7de71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions openquake/calculators/postproc/compute_rtgm.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ def main(dstore, csm):
if not rtgmpy:
logging.warning('Missing module rtgmpy: skipping AELO calculation')
return
if dstore['mean_rates_ss'][:].max() < 1E-3:
logging.warning('Ultra-low hazard: skipping AELO calculation')
return
logging.info('Computing Risk Targeted Ground Motion')
oq = dstore['oqparam']
stats = list(oq.hazard_stats())
Expand Down
12 changes: 7 additions & 5 deletions openquake/calculators/postproc/disagg_by_rel_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from openquake.calculators import extract


def get_mag_dist_eps_df(
mean_disagg_by_src, src_mutex, src_info):
def get_mag_dist_eps_df(mean_disagg_by_src, src_mutex, src_info):
"""
Compute mag, dist, eps, sig for each (src, imt) combination.
Expand All @@ -47,9 +46,12 @@ def get_mag_dist_eps_df(
grp[src] = grp_id
for s, src in enumerate(mean_disagg_by_src.source_id):
for m, imt in enumerate(mean_disagg_by_src.imt):
rates_mag = mean_disagg_by_src[s, :, :, :, m].sum((1, 2))
rates_dst = mean_disagg_by_src[s, :, :, :, m].sum((0, 2))
rates_eps = mean_disagg_by_src[s, :, :, :, m].sum((0, 1))
rates = mean_disagg_by_src[s, :, :, :, m]
if (rates == 0).all():
continue # no contribution from this imt
rates_mag = rates.sum((1, 2))
rates_dst = rates.sum((0, 2))
rates_eps = rates.sum((0, 1))
dic['src'].append(src)
dic['imt'].append(imt)
# NB: 0=mag, 1=dist, 2=eps are the dimensions of the array
Expand Down

0 comments on commit 4b7de71

Please sign in to comment.