From bc4d57a5ab1e115dc2c2f7d937e21ff30bc635ec Mon Sep 17 00:00:00 2001 From: ftong Date: Wed, 2 Jul 2025 14:27:33 +0200 Subject: [PATCH] catch null result from ground motion forecasting --- src/seismic_hazard_forecasting.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/seismic_hazard_forecasting.py b/src/seismic_hazard_forecasting.py index 30d0132..8fae701 100644 --- a/src/seismic_hazard_forecasting.py +++ b/src/seismic_hazard_forecasting.py @@ -462,6 +462,11 @@ verbose: {verbose}") end = timer() logger.info(f"Ground motion exceedance computation time: {round(end - start, 1)} seconds") + if np.isnan(iml_grid_raw).all(): + msg = "No valid ground motion intensity measures were forecasted. Try a different ground motion model." + logger.error(msg) + raise Exception(msg) + # create list of one empty list for each imt iml_grid = [[] for _ in range(len(products))] # final ground motion grids iml_grid_prep = iml_grid.copy() # temp ground motion grids