From 1244655a687e6fcfa775744591e0b84750c5bd85 Mon Sep 17 00:00:00 2001 From: ftong Date: Mon, 7 Jul 2025 15:07:33 +0200 Subject: [PATCH] Update src/seismic_hazard_forecasting.py --- src/seismic_hazard_forecasting.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/seismic_hazard_forecasting.py b/src/seismic_hazard_forecasting.py index 77ef2bd..806ca6c 100644 --- a/src/seismic_hazard_forecasting.py +++ b/src/seismic_hazard_forecasting.py @@ -112,14 +112,6 @@ verbose: {verbose}") dask.config.set(scheduler='processes') - # validate m_max against the grond motion model if forecasting was selected - models_anthro_limited = ['Lasocki2013', 'Atkinson2015', 'ConvertitoEtAl2012Geysers'] # these models require that m_max<=4.5 - if forecast_select: - if m_max > 4.5 and model in models_anthro_limited: - msg = "Selected ground motion model only valid up to a maximum magnitude of 4.5. Please try again with a lower maximum magnitude." - logger.error(msg) - raise Exception(msg) - # run magnitude distribution modeling if selected by user and no magnitude pdf file provided if m_select and m_range[0] == None and m_pdf[0] == None: logger.info("Magnitude distribution modeling selected") @@ -169,6 +161,7 @@ verbose: {verbose}") if m_max == None: m_max = mag.max() + 1.0 logger.info(f"No m_max was given. Therefore m_max is automatically set to: {m_max}") + start = timer() t_windowed, r_windowed = win_CNE(time, [lon, lat, mag], win_size=len(mag), win_overlap=0, min_events=1) @@ -374,18 +367,26 @@ verbose: {verbose}") if forecast_select: products = products_string.split() - logger.info( - f"Ground motion forecasting selected with ground motion model {model} and IMT products {products_string}") + logger.info(f"Ground motion forecasting selected with ground motion model {model} and IMT products {products_string}") + + # validate m_max against the grond motion model + models_anthro_limited = ['Lasocki2013', 'Atkinson2015', 'ConvertitoEtAl2012Geysers'] # these models require that m_max<=4.5 + if m_max > 4.5 and model in models_anthro_limited: + msg = f"Selected ground motion model {model} is only valid up to a maximum magnitude of 4.5. Please try again with a lower maximum magnitude." + logger.error(msg) + raise Exception(msg) if not xy_select: msg = "Event location distribution modeling was not selected; cannot continue..." logger.error(msg) raise Exception(msg) - elif m_pdf[0] == None: + + if m_pdf[0] == None: msg = "Magnitude distribution modeling was not selected and magnitude PDF file was not provided; cannot continue..." logger.error(msg) raise Exception(msg) - elif lambdas[0] == None: + + if lambdas[0] == None: msg = "Activity rate modeling was not selected and custom activity rate was not provided; cannot continue..." logger.error(msg) raise Exception(msg)