|
|
@ -169,6 +169,7 @@ def get_ongoing_recession(n_runs, start_year, end_year, sea_level_rise,
|
|
|
|
'min' (array_like): minimum value
|
|
|
|
'min' (array_like): minimum value
|
|
|
|
'mode' (array_like): most likely value
|
|
|
|
'mode' (array_like): most likely value
|
|
|
|
'max' (array_like): maximum value
|
|
|
|
'max' (array_like): maximum value
|
|
|
|
|
|
|
|
'function' (str): optional external function ('package.function')
|
|
|
|
bruun_factor (dict):
|
|
|
|
bruun_factor (dict):
|
|
|
|
'min' (float): minimum value
|
|
|
|
'min' (float): minimum value
|
|
|
|
'mode' (float): most likely value
|
|
|
|
'mode' (float): most likely value
|
|
|
@ -180,6 +181,12 @@ def get_ongoing_recession(n_runs, start_year, end_year, sea_level_rise,
|
|
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Returns:
|
|
|
|
the simulated recession distance (m)
|
|
|
|
the simulated recession distance (m)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Notes:
|
|
|
|
|
|
|
|
'sea_level_rise' is calculated with a triangular probability distribution
|
|
|
|
|
|
|
|
by default. Alternatively 'sea_level_rise' can be calculated using an
|
|
|
|
|
|
|
|
external function, to which the arguments 'n_runs', 'start_year', and
|
|
|
|
|
|
|
|
'end_year' are passed.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
# Get time interval from input file
|
|
|
|
# Get time interval from input file
|
|
|
@ -187,6 +194,15 @@ def get_ongoing_recession(n_runs, start_year, end_year, sea_level_rise,
|
|
|
|
n_years = len(years)
|
|
|
|
n_years = len(years)
|
|
|
|
|
|
|
|
|
|
|
|
# Interpolate sea level rise projections (m)
|
|
|
|
# Interpolate sea level rise projections (m)
|
|
|
|
|
|
|
|
if sea_level_rise['function']: # Get slr from separate function
|
|
|
|
|
|
|
|
# Get names of package/script and function
|
|
|
|
|
|
|
|
pkg, func_name = sea_level_rise['function'].split('.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Import function from package
|
|
|
|
|
|
|
|
func = getattr(__import__(pkg), func_name)
|
|
|
|
|
|
|
|
slr = func(n_runs=n_runs, start_year=start_year, end_year=end_year)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else: # Use triangular distribution
|
|
|
|
slr_mode = np.interp(years,
|
|
|
|
slr_mode = np.interp(years,
|
|
|
|
xp=sea_level_rise['year'],
|
|
|
|
xp=sea_level_rise['year'],
|
|
|
|
fp=sea_level_rise['mode'])[:, np.newaxis]
|
|
|
|
fp=sea_level_rise['mode'])[:, np.newaxis]
|
|
|
|