2929
3030from climada import CONFIG
3131from climada .engine .impact import Impact
32+ from climada .engine .impact_forecast import ImpactForecast
33+ from climada .hazard .forecast import HazardForecast
3234
3335LOGGER = logging .getLogger (__name__ )
3436
@@ -217,7 +219,7 @@ def _return_impact(self, imp_mat_gen, save_mat):
217219
218220 Returns
219221 -------
220- Impact
222+ Impact or ImpactForecast
221223 Impact Object initialize from the impact matrix
222224
223225 See Also
@@ -233,9 +235,18 @@ def _return_impact(self, imp_mat_gen, save_mat):
233235 else :
234236 imp_mat = None
235237 at_event , eai_exp , aai_agg = self .stitch_risk_metrics (imp_mat_gen )
236- return Impact .from_eih (
238+
239+ impact = Impact .from_eih (
237240 self .exposures , self .hazard , at_event , eai_exp , aai_agg , imp_mat
238241 )
242+ if isinstance (self .hazard , HazardForecast ):
243+ return ImpactForecast ().from_impact (
244+ impact , self .hazard .ensemble_member , self .hazard .lead_time
245+ ) # return ImpactForecast object
246+ else :
247+ return (
248+ impact # return normal impact object if hazard is not a HazardForecast
249+ )
239250
240251 def _return_empty (self , save_mat ):
241252 """
0 commit comments