Skip to content

Impact calc return impact forecast#1179

Merged
peanutfun merged 24 commits intoforecast-classfrom
impactCalc_return_impactForecast
Dec 9, 2025
Merged

Impact calc return impact forecast#1179
peanutfun merged 24 commits intoforecast-classfrom
impactCalc_return_impactForecast

Conversation

@luseverin
Copy link
Collaborator

@luseverin luseverin commented Dec 8, 2025

Changes proposed in this PR:

  • Make ImapctCalc return ImpactForecast object when hazardForecast object is passed

This PR fixes #1138 #1135

PR Author Checklist

PR Reviewer Checklist

@chahank
Copy link
Member

chahank commented Dec 8, 2025

We should raise an error if save_mat=False and the input is a HazardForecast object.

@luseverin
Copy link
Collaborator Author

TODO:

  • Remove tests for eai_exp in test_impactForecast as this attribute should not be used with impactForecasts.


@at_event.setter
def at_event(self, value):
"""Set the total exposure value close to a hazard"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does that mean? This is not what at_event does.

Suggested change
"""Set the total exposure value close to a hazard"""
"""Set the total exposure value close to a hazard"""

@at_event.setter
def at_event(self, value):
"""Set the total exposure value close to a hazard"""
LOGGER.warning("at_event for forecasts is not yet implemented.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at_event is implemented for forecasts. This is confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rewrite it a bit

Comment on lines +126 to +127
aai_agg = np.sum(exposure.gdf["value"]) * hazard.frequency[0]
eai_exp = np.ones(exposure.gdf.shape[0]) * hazard.frequency[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supposed to be nans no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the ImpactForecast tests, yes:

def impact_calc_forecast(self, impact_calc):

@peanutfun peanutfun merged commit 6a156ac into forecast-class Dec 9, 2025
12 of 14 checks passed
@emanuel-schmid emanuel-schmid deleted the impactCalc_return_impactForecast branch December 11, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants