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

MOBT-494: Phase probability plugin without percentile generation #1903

Merged
merged 8 commits into from
Jun 5, 2023

Conversation

bayliffe
Copy link
Contributor

Follows #1902

The phase-probability CLI and plugin have been modified to remove the internal neighbourhooding. Instead the plugin now relies upon input data being provided with percentile data if that is desired, where these percentiles may have been constructed from a neighbourhood. This will allow us to use this plugin with spot data, where the percentiles have been generated on the grid prior to spot extraction; we can't neighbourhood spot-data sensibly.

The changes also allow us to extract probabilities without the use of neighbourhoods (and no resulting percentile coordinate), such that we can use non-equal-area grid data without having to apply neighbourhoods. This allows us to continue using the phase-probability plugin with global data (as was recently implemented: #1902).

Testing:

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

@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Merging #1903 (9051f20) into master (304cb48) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1903      +/-   ##
==========================================
- Coverage   98.33%   98.32%   -0.01%     
==========================================
  Files         120      120              
  Lines       11383    11376       -7     
==========================================
- Hits        11193    11186       -7     
  Misses        190      190              
Impacted Files Coverage Δ
...hrometric_calculations/precip_phase_probability.py 98.14% <100.00%> (-0.22%) ⬇️

Copy link
Contributor

@mspelman07 mspelman07 left a comment

Choose a reason for hiding this comment

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

Thanks Ben. Generally it looks good and all the test passed. There's just a couple of typos and a query about one of the ValueError's you're raising.

Copy link
Contributor

@mspelman07 mspelman07 left a comment

Choose a reason for hiding this comment

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

One small update of adding the error message to the docstring as I mentioned above along with some conflicts to resolve.

mspelman07
mspelman07 previously approved these changes May 24, 2023
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.

I think this change does what we need.

As well as the two suggestions, I cannot see any tests with non-equal-area gridded data, which these changes are targetting. Could a test be added somewhere? I can't see any reason why it should fail, but...

@bayliffe
Copy link
Contributor Author

bayliffe commented Jun 5, 2023

@MoseleyS I've added some acceptance tests to demonstrate that the code works with lat-lon grids.

bayliffe added 8 commits June 5, 2023 09:34
… a rain or snow phase is chosen if somehow the falling level of the two is identical; this would otherwise end up as sleet, which is not awful either, but here we hedge by the slightest amount towards snow.
@MoseleyS MoseleyS merged commit c1a5188 into metoppv:master Jun 5, 2023
bayliffe added a commit that referenced this pull request Jun 20, 2023
@bayliffe bayliffe deleted the mobt494 branch July 26, 2023 10:23
MoseleyS pushed a commit to MoseleyS/improver that referenced this pull request Aug 22, 2024
…oppv#1903)

* Starting to rewrite tests.

* Unit tests updated.

* Tweaks to unit tests and new acceptance tests.

* Further tests added. Comparator for snow changed to ge to ensure that a rain or snow phase is chosen if somehow the falling level of the two is identical; this would otherwise end up as sleet, which is not awful either, but here we hedge by the slightest amount towards snow.

* Checksum update and style fixes.

* Add extra test.

* Add value error to doc-string.

* Review changes.
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