metoppv / improver

IMPROVER is a library of algorithms for meteorological post-processing.
http://improver.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
101 stars 84 forks source link

`apply_bias_correction` fix: add handling for missing forecast cube #1995

Closed benowen-bom closed 2 months ago

benowen-bom commented 2 months ago

Addresses #1994

This PR the function split_forecasts_and_bias_files to separate out the forecast cube from the forecast_error (bias) cubes based on cube.name(). Raises a Value Error when the forecast cube is not present, or when multiple forecast cubes have been passed in.

The CLI now adds a warning when no bias_cubes are present and adds a comment to the attributes in the forecast (in line with how apply_emos_coefficients handles similar use case.

Acceptance tests have been added to test this behaviour explicitly to ensure #1994 has been resolved. There is a new kgo that has been added for the case where no bias-cubes are added, included in the following PR: https://github.com/metoppv/improver_test_data/pull/47.

Testing:

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.41%. Comparing base (84a8944) to head (766ae96). Report is 5 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1995 +/- ## ========================================== + Coverage 98.39% 98.41% +0.01% ========================================== Files 124 124 Lines 12212 12337 +125 ========================================== + Hits 12016 12141 +125 Misses 196 196 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

benowen-bom commented 2 months ago

Thanks @benowen-bom 👍

I think that this essentially looks fine. I've suggested some minor typo corrections.

Thanks Gavin for the review and picking up those typos. All fixed.