Skip to content

Commit 612a53c

Browse files
committed
Merge branch 'impactCalc_return_impactForecast' of https://github.com/CLIMADA-project/climada_python into impactCalc_return_impactForecast
2 parents f3ab44a + 30ed14d commit 612a53c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

climada/engine/impact_forecast.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,24 @@ def at_event(self, value):
9898
"""Set the total exposure value close to a hazard"""
9999
LOGGER.warning("at_event for forecasts is not yet implemented.")
100100
self._at_event = value
101+
102+
def local_exceedance_impact(
103+
self,
104+
return_periods=(25, 50, 100, 250),
105+
method="interpolate",
106+
min_impact=0,
107+
log_frequency=True,
108+
log_impact=True,
109+
bin_decimals=None,
110+
):
111+
"""Compution of local exceedance impact for given return periods is not
112+
implemented for ImpactForecast. See climada.engine.impact.Impact for details.
113+
Returns
114+
-------
115+
NotImplementedError
116+
"""
117+
118+
LOGGER.error("local_exceedance_impact is not defined for ImpactForecast")
119+
raise NotImplementedError(
120+
"local_exceedance_impact is not defined for ImpactForecast"
121+
)

climada/engine/test/test_impact_forecast.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,9 @@ def test_impact_forecast_concat(impact_forecast, member):
103103
[impact_forecast, impact_forecast], reset_event_ids=True
104104
)
105105
npt.assert_array_equal(impact_fc.member, np.concatenate([member, member]))
106+
107+
108+
def test_impact_forecast_exceedance_freq_curve_error(impact_forecast):
109+
"""Check if ImpactForecast.exceedance_freq_curve raises NotImplementedError"""
110+
with pytest.raises(NotImplementedError):
111+
impact_forecast.local_exceedance_impact(np.array([10, 50, 100]))

0 commit comments

Comments
 (0)