improve error message when user provides magnitude file incompatible with ground motion model

This commit is contained in:
ftong 2025-07-09 15:09:44 +02:00
parent dd84829b6d
commit 2906af6918

View File

@ -378,8 +378,11 @@ verbose: {verbose}")
# 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."
if m_max > 4.5 and model in models_anthro_limited:
if m_file is None:
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."
else:
msg = f"Selected ground motion model {model} is only valid up to a maximum magnitude of 4.5. The magnitude file provided has a range up to {m_max}."
logger.error(msg)
raise Exception(msg)