Skip to content

Commit db32170

Browse files
committed
Write nans for eai_exp and aai_agg when forecast is used
1 parent 899d8f0 commit db32170

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

climada/engine/impact_calc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ def _return_impact(self, imp_mat_gen, save_mat):
232232
at_event, eai_exp, aai_agg = self.risk_metrics(
233233
imp_mat, self.hazard.frequency
234234
)
235+
if isinstance(self.hazard, HazardForecast):
236+
eai_exp = np.nan * np.ones(eai_exp.shape, dtype=eai_exp.dtype)
237+
aai_agg = np.nan * np.ones(aai_agg.shape, dtype=aai_agg.dtype)
238+
LOGGER.warning(
239+
"eai_exp and aai_agg are undefined with forecasts. "
240+
"Setting them to empty arrays."
241+
)
242+
235243
else:
236244
if isinstance(self.hazard, HazardForecast):
237245
raise ValueError(

0 commit comments

Comments
 (0)