Update src/seismic_hazard_forecasting.py

This commit is contained in:
2025-08-22 11:44:16 +02:00
parent ad36f87414
commit 5473639ad7

View File

@@ -26,8 +26,6 @@ def my_trivial_task(x):
def compute_IMT_exceedance(rx_lat, rx_lon, r, fr, p, lambdas, D, percentages_D, magnitudes, magnitude_pdf, magnitude_cdf, model, imt='PGA', IMT_min=0.01, IMT_max=2.0, rx_label=None, rtol=0.1, use_cython=False, **kwargs): def compute_IMT_exceedance(rx_lat, rx_lon, r, fr, p, lambdas, D, percentages_D, magnitudes, magnitude_pdf, magnitude_cdf, model, imt='PGA', IMT_min=0.01, IMT_max=2.0, rx_label=None, rtol=0.1, use_cython=False, **kwargs):
return None
n_events = len(r) n_events = len(r)
try: try:
@@ -148,7 +146,7 @@ def compute_IMT_exceedance(rx_lat, rx_lon, r, fr, p, lambdas, D, percentages_D,
return exceedance_prob_sum - p return exceedance_prob_sum - p
return None
# Check function values at different test points # Check function values at different test points
IMT_mid = (IMT_max-IMT_min)/2 IMT_mid = (IMT_max-IMT_min)/2
@@ -678,13 +676,15 @@ verbose: {verbose}")
end = timer() end = timer()
logger.info(f"Ground motion exceedance computation time: {round(end - start, 1)} seconds") logger.info(f"Ground motion exceedance computation time: {round(end - start, 1)} seconds")
logger.info("Test3 run finished")
sys.exit()
if np.isnan(iml_grid_raw).all(): if np.isnan(iml_grid_raw).all():
msg = "No valid ground motion intensity measures were forecasted. Try a different ground motion model." msg = "No valid ground motion intensity measures were forecasted. Try a different ground motion model."
logger.error(msg) logger.error(msg)
raise Exception(msg) raise Exception(msg)
logger.info("Test3 run finished")
sys.exit()
# create list of one empty list for each imt # create list of one empty list for each imt
iml_grid = [[] for _ in range(len(products))] # final ground motion grids iml_grid = [[] for _ in range(len(products))] # final ground motion grids