Skip to content

Commit bd3502f

Browse files
committed
Return impactForecast object in _return_empty
1 parent 7da50f1 commit bd3502f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

climada/engine/impact_calc.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def _return_empty(self, save_mat):
259259
260260
Returns
261261
-------
262-
Impact
262+
Impact or ImpactForecast
263263
Empty impact object with correct array sizes.
264264
"""
265265
at_event = np.zeros(self.n_events)
@@ -271,9 +271,17 @@ def _return_empty(self, save_mat):
271271
)
272272
else:
273273
imp_mat = None
274-
return Impact.from_eih(
274+
impact = Impact.from_eih(
275275
self.exposures, self.hazard, at_event, eai_exp, aai_agg, imp_mat
276276
)
277+
if isinstance(self.hazard, HazardForecast):
278+
return ImpactForecast().from_impact(
279+
impact, self.hazard.ensemble_member, self.hazard.lead_time
280+
) # return ImpactForecast object
281+
else:
282+
return (
283+
impact # return normal impact object if hazard is not a HazardForecast
284+
)
277285

278286
def minimal_exp_gdf(
279287
self, impf_col, assign_centroids, ignore_cover, ignore_deductible

0 commit comments

Comments
 (0)