Skip to content

Commit

Permalink
rerun hazard tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinGebhart committed Sep 28, 2024
1 parent eb49fe3 commit d658bbc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 53 deletions.
2 changes: 1 addition & 1 deletion climada/engine/impact.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def plot_basemap_impact_exposure(self, event_id=1, mask=None, ignore_zero=False,
def plot_rp_imp(self, return_periods=(25, 50, 100, 250),
log10_scale=True, smooth=True, axis=None, **kwargs):
"""
This function is deprecated, use Impact.local_exceedance_impact and
This function is deprecated, use Impact.local_exceedance_impact and
util.plot.plot_from_gdf instead.
"""
LOGGER.warning("The use of Impact.plot_rp_imp is deprecated."
Expand Down
11 changes: 4 additions & 7 deletions climada/util/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ def interpolate_ev(
if x_train.size < 2:
if not extrapolation:
return np.full_like(x_test, np.nan)
else:
LOGGER.warning('Data is being extrapolated.')
return _interpolate_small_input(x_test, x_train, y_train, logy, y_asymptotic)
LOGGER.warning('Data is being extrapolated.')
return _interpolate_small_input(x_test, x_train, y_train, logy, y_asymptotic)

# warn if values are being extrapolated
if extrapolation and (np.min(x_test) < np.min(x_train) or np.max(x_test) > np.max(x_train)):
Expand All @@ -100,7 +99,7 @@ def interpolate_ev(
elif extrapolation == 'extrapolate_constant':
if not all(sorted(x_train) == x_train):
raise ValueError('x_train array must be sorted in ascending order.')
fill_value = (y_train[0], np.log10(y_asymptotic) if logy else y_asymptotic)
fill_value = (y_train[0], np.log10(y_asymptotic) if logy else y_asymptotic)
else:
fill_value = np.nan

Expand Down Expand Up @@ -151,13 +150,11 @@ def stepfunction_ev(
x_test, x_train, y_train, None, None, x_threshold, y_threshold
)



# handle case of small training data sizes
if x_train.size < 2:
LOGGER.warning('Data is being extrapolated.')
return _interpolate_small_input(x_test, x_train, y_train, None, y_asymptotic)

# warn if values are being extrapolated
if (np.min(x_test) < np.min(x_train) or np.max(x_test) > np.max(x_train)):
LOGGER.warning('Data is being extrapolated.')
Expand Down
64 changes: 19 additions & 45 deletions doc/tutorial/climada_hazard_Hazard.ipynb

Large diffs are not rendered by default.

0 comments on commit d658bbc

Please sign in to comment.