Update src/seismic_hazard_forecasting.py

This commit is contained in:
ftong 2025-07-07 16:36:40 +02:00
parent 1244655a68
commit 36378f4d6c

View File

@ -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]]