Update src/seismic_hazard_forecasting.py
This commit is contained in:
@@ -174,30 +174,30 @@ def compute_IMT_exceedance(rx_lat, rx_lon, r, fr, p, lambdas, D, percentages_D,
|
|||||||
|
|
||||||
if np.sign(lower_bound_value) == np.sign(upper_bound_value):
|
if np.sign(lower_bound_value) == np.sign(upper_bound_value):
|
||||||
msg = "Function values at the interval endpoints must differ in sign for fsolve to work. Expand the interval or use a different model."
|
msg = "Function values at the interval endpoints must differ in sign for fsolve to work. Expand the interval or use a different model."
|
||||||
#logger.error(msg)
|
logger.error(msg)
|
||||||
gm_est = np.nan
|
gm_est = np.nan
|
||||||
return gm_est
|
return gm_est
|
||||||
# raise ValueError(msg)
|
# raise ValueError(msg)
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Find root of function
|
# Find root of function
|
||||||
start = timer()
|
start = timer()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
method='brenth'
|
method='brenth'
|
||||||
#logger.debug("Now trying Scipy " + method)
|
logger.debug("Now trying Scipy " + method)
|
||||||
output = root_scalar(exceedance_root_function, bracket=[IMT_min, IMT_max], rtol=rtol, method=method)
|
#output = root_scalar(exceedance_root_function, bracket=[IMT_min, IMT_max], rtol=rtol, method=method)
|
||||||
gm_est = output.root
|
#gm_est = output.root
|
||||||
|
gm_est = np.nan
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
#logger.error(f"An exception occurred: {error}")
|
logger.error(f"An exception occurred: {error}")
|
||||||
#logger.info("Set ground motion value to nan")
|
logger.info("Set ground motion value to nan")
|
||||||
gm_est = np.nan
|
gm_est = np.nan
|
||||||
|
|
||||||
end = timer()
|
end = timer()
|
||||||
#logger.info(f"Ground motion estimation computation time: {round(end - start,1)} seconds")
|
logger.info(f"Ground motion estimation computation time: {round(end - start,1)} seconds")
|
||||||
#logger.info(f"Estimated {imt}: {gm_est}")
|
logger.info(f"Estimated {imt}: {gm_est}")
|
||||||
|
|
||||||
return gm_est
|
return gm_est
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user