From 36378f4d6ca404437ad9706619fccb2c6f6b1a12 Mon Sep 17 00:00:00 2001 From: ftong Date: Mon, 7 Jul 2025 16:36:40 +0200 Subject: [PATCH] Update src/seismic_hazard_forecasting.py --- src/seismic_hazard_forecasting.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/seismic_hazard_forecasting.py b/src/seismic_hazard_forecasting.py index 806ca6c..e41d787 100644 --- a/src/seismic_hazard_forecasting.py +++ b/src/seismic_hazard_forecasting.py @@ -339,6 +339,12 @@ verbose: {verbose}") elif time_unit == 'years': multiplicator = 1 / 365 + # Raise an exception when time_range from the user is too large + if time_range/multiplicator > 0.5*(time[-1] - time[0]): + msg = "Activity rate estimation time window must be less than half the catalog length. Use a shorter time window." + logger.error(msg) + raise Exception(msg) + # Selects dates in datenum format and procceeds to forecast value start_date = datenum_data[-1] - (2 * time_win_duration / multiplicator) dates_calc = [date for date in datenum_data if start_date <= date <= datenum_data[-1]]