Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure consistent percentiles from EMOS if no coefficients provided #1615

Conversation

gavinevans
Copy link
Contributor

Related to https://github.com/metoppv/mo-blue-team/issues/108

Description
This PR ensures that if a list of desired percentiles are provided, then the forecast resulting from the apply-emos-coefficients CLI will have these desired percentiles whether or not the coefficients are provided.

Further information is available in this comment.

Testing:

  • Ran tests and they passed OK
  • Added new tests for the new feature(s)

@gavinevans gavinevans added this to the 1.0.0 milestone Nov 15, 2021
@gavinevans gavinevans self-assigned this Nov 15, 2021
@codecov
Copy link

codecov bot commented Nov 15, 2021

Codecov Report

Merging #1615 (0ee3863) into Hotfix_branch_1.0.2 (a394c03) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@                 Coverage Diff                  @@
##           Hotfix_branch_1.0.2    #1615   +/-   ##
====================================================
  Coverage                98.07%   98.07%           
====================================================
  Files                      110      110           
  Lines                    10003    10003           
====================================================
  Hits                      9810     9810           
  Misses                     193      193           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a394c03...0ee3863. Read the comment docs.

@gavinevans gavinevans removed their assignment Nov 15, 2021
Copy link
Contributor

@bayliffe bayliffe left a comment

Choose a reason for hiding this comment

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

A couple of small comments Gavin.

improver/cli/apply_emos_coefficients.py Outdated Show resolved Hide resolved
@@ -157,6 +157,31 @@ def process(
warnings.warn(msg)
return prob_template

if percentiles:
percentiles = [np.float32(p) for p in percentiles]
constr = iris.Constraint(percentile=percentiles)
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably needs to be a lambda function to handle float comparisons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For robustness, I've altered this to be use a lambda function for the float comparison.

Copy link
Contributor

@MoseleyS MoseleyS left a comment

Choose a reason for hiding this comment

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

Tiny things... but...

improver/cli/apply_emos_coefficients.py Show resolved Hide resolved
improver_tests/acceptance/SHA256SUMS Outdated Show resolved Hide resolved
improver_tests/acceptance/SHA256SUMS Outdated Show resolved Hide resolved
@gavinevans gavinevans force-pushed the mobt108_consistent_percentiles branch from a11b3fe to 0ee3863 Compare November 15, 2021 16:07
@gavinevans gavinevans merged commit 9184ec4 into metoppv:Hotfix_branch_1.0.2 Nov 15, 2021
@gavinevans gavinevans deleted the mobt108_consistent_percentiles branch November 15, 2021 16:47
MoseleyS pushed a commit to MoseleyS/improver that referenced this pull request Aug 22, 2024
…etoppv#1615)

* Add ability to subset the input forecast if no coefficients are provided but a list of desired percentiles are provided.

* Modifications to raise an error if the percentiles requested are not within the input forecast.

* Updates following review comments.

* Update checksums by branching from 1.0.1 tag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants