Skip to content

Conversation

@peanutfun
Copy link
Member

@peanutfun peanutfun commented Nov 21, 2025

Changes proposed in this PR:

  • Add forecast variants for Hazard and Impact.
  • Adapt ImpactCalc to return ImpactForecast when needed.
  • Add tests.
  • Add tutorial for forecast data.

This PR resolves a major portion of #1118. Note that sub-tasks have been marked as completed when merged into this branch.

PR Author Checklist

PR Reviewer Checklist

peanutfun and others added 21 commits November 21, 2025 18:23
* define base class
* add init test
* Fix #1127

---------

Co-authored-by: Valentin Gebhart <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* Add ImpactForecast
* Add unit tests
* Create hazardForecast base class
* Update datetime to timedelta for lead_time
* Add tests

---------

Co-authored-by: luseverin <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* change leadtime to timedelta
* adapt impactforecast docstrings and tests
* Remove stray comment

---------

Co-authored-by: Lukas Riedel <[email protected]>
* Add HazardForecast.select test

---------

Co-authored-by: luseverin <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* Add test for hazardForecast.concat
* Skip HazardForecast.concat test

---------

Co-authored-by: luseverin <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* Add test for ImpactForecast.select
* minor test modification

---------

Co-authored-by: Evelyn Mühlhofer <[email protected]>
* Add test stub for ImpactForecast.concat
* Use correct command for skipping a test
* Fix merge issue
* Add data shape check for HazardForecast, ImpactForecast
Adapt Hazard from_hdf5 and write_hdf5 to forecast attributes
* Add extended select impact forecast test
* Add extended hazard forecast test

---------

Co-authored-by: Chahan Kropf <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* Return impactForecast object in _return_impact
* Return impactForecast object in _return_empty
* Add full  impactcalc test for impactForecast
* Raise value error when computing impact with impact forecast without saving impact matrix
* Cosmetics: Improve error message, move test to own class
* Write nans for eai_exp and aai_agg when forecast is used

---------

Co-authored-by: luseverin <[email protected]>
Co-authored-by: Chahan Kropf <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* add idx boolean selection for member and leadtime
* Add test for weird data types

---------

Co-authored-by: Lukas Riedel <[email protected]>
* Add ImpactForecast.select

---------

Co-authored-by: Lukas Riedel <[email protected]>
* add HazardForecast.select and extent test

---------

Co-authored-by: Eliane Kobler <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
peanutfun and others added 8 commits December 10, 2025 14:32
* Add HazardForecast.concat
Add min/mean/max methods

---------

Co-authored-by: luseverin <[email protected]>
Co-authored-by: Chahan Kropf <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* Make Impact.concat support ImpactForecast
* Add tests
* implement changes in Impact IO and ImpactForecast IO
* Update tests
* Fix small issue when reading H5 for ImpactForecast

---------

Co-authored-by: Lukas Riedel <[email protected]>
* Add quantile and median for hazard and impact forecast
* Review

---------

Co-authored-by: luseverin <[email protected]>
Co-authored-by: Chahan Kropf <[email protected]>
Co-authored-by: Lukas Riedel <[email protected]>
* Add impact forecast tutorial
* Add 'dim' argument to reductions
* Update tests

---------

Co-authored-by: Lukas Riedel <[email protected]>
Co-authored-by: luseverin <[email protected]>
Co-authored-by: Evelyn Mühlhofer <[email protected]>
Co-authored-by: Chahan Kropf <[email protected]>
@peanutfun peanutfun changed the title Forecast classes Add forecast classes Jan 12, 2026
@peanutfun peanutfun marked this pull request as ready for review January 12, 2026 13:54
@peanutfun
Copy link
Member Author

@Evelyn-M How was the fcst_icon_seamless_2024-06-18_12_00.nc test file created? I see that it's in a different CRS than the "latest" example files downloaded in the tutorial.

@Evelyn-M
Copy link
Collaborator

Evelyn-M commented Feb 4, 2026

@Evelyn-M How was the fcst_icon_seamless_2024-06-18_12_00.nc test file created? I see that it's in a different CRS than the "latest" example files downloaded in the tutorial.

I downloaded it from the meteoswiss-internal data storage, since the API only permits downloads until -24 hrs.

@peanutfun
Copy link
Member Author

So it had been reprojected? Does MCH store the data differently than OGD? I am just wondering because it might be important to highlight the caveats when importing datasets with varying CRS and coordinate specifications.

@Evelyn-M
Copy link
Collaborator

Evelyn-M commented Feb 5, 2026

I suppose so, yes. One is the MCH grid commonly used internally for national gridded forecast products, and the OGD data has a different grid and a much larger rectangular extent around Switzerland.

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.

6 participants