Skip to content

Conversation

@luseverin
Copy link
Collaborator

@luseverin luseverin commented Dec 10, 2025

Changes proposed in this PR:

  • Implement quantiles and median reduction for hazard and impact forecasts

This PR fixes #1162

PR Author Checklist

PR Reviewer Checklist

luseverin and others added 30 commits December 8, 2025 15:10

def mean(self):
"""
Reduce the impact matrix and at_event of an ImpactForecast to the mean value.
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, you want to reduce only along the event axis (0). So this is not a single mean value. But a mean value per exposure point.


def _reduce_attrs(self, event_name: str):
"""
Reduce the attributes of an ImpactForecast to a single value.
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, you want to reduce only along the event axis (0). So this is not a single mean value. But a reduced value per exposure point. The docstring could be clearer.

Comment on lines 197 to 198
Reduce the intensity and fraction of a HazardForecast to the minimum
value.
Copy link
Member

Choose a reason for hiding this comment

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

Here also the docstring are misleading imho.

Suggested change
Reduce the intensity and fraction of a HazardForecast to the minimum
value.
Reduce the intensity and fraction of a HazardForecast to the minimum
over all events value per centroid.

Returns
-------
HazardForecast
A HazardForecast object with the min intensity and fraction.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
A HazardForecast object with the min intensity and fraction.
A HazardForecast object with the min intensity and fraction per centroid.


def median(self):
"""
Reduce the impact matrix and at_event of a HazardForecast to the median value.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Reduce the impact matrix and at_event of a HazardForecast to the median value.
Reduce the impact matrix and at_event of a HazardForecast to the median value over all events.

@peanutfun
Copy link
Member

@chahank We'll have to rework all docstrings before merging into develop anyway. Merging now.

@peanutfun peanutfun merged commit e66a558 into forecast-class Dec 10, 2025
12 of 14 checks passed
@emanuel-schmid emanuel-schmid deleted the implement_quantiles 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.

4 participants