8000 MOBT-689 (Pt2): Spot forecast subsetting using a neighbour cube by bayliffe · Pull Request #2002 · metoppv/improver · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MOBT-689 (Pt2): Spot forecast subsetting using a neighbour cube #2002

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

Merged
merged 9 commits into from
Jun 18, 2024

Conversation

bayliffe
Copy link
Contributor

Allows a user to subset an existing spot-forecast via the spot-extraction CLI using a neighbour cube. This will allow us to apply a verification neighbour cube to the end-of-chain forecasts in the preverspot steps to produce a much smaller and controlled set of sites for verification. It removes the need for the preverspot step in the suite to be aliased to different commands for different steps in the chain.

This subsetting is performed using a coordinate selected by the user, with the doc-strings indicating this should be an ID coordinate (e.g. wmo_id or met_office_site_id), rather than e.g. altitude. I have not designed this to handle float comparisons, nor constraining on multiple coordinates as would be required if sites were to be extracted using latitude + longitude.

Acceptance test data: metoppv/improver_test_data#46

Testing:

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

Copy link
codecov bot commented May 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.42%. Comparing base (84a8944) to head (8fa5478).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2002      +/-   ##
==========================================
+ Coverage   98.39%   98.42%   +0.02%     
==========================================
  Files         124      126       +2     
  Lines       12212    12417     +205     
==========================================
+ Hits        12016    12221     +205     
  Misses        196      196              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gavinevans gavinevans self-assigned this May 30, 2024
Copy link
Contributor
@gavinevans gavinevans left a comment

Choose a reason for hiding this comment

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

Thanks @bayliffe 👍

I've added minor comments, with the most significant comment being related to the handling of lapse rate correction, given that spot forecasts are now accepted as input to the spot extract step.

@gavinevans gavinevans assigned bayliffe and unassigned gavinevans May 31, 2024
@bayliffe bayliffe assigned gavinevans and unassigned bayliffe Jun 7, 2024
@Kat-90 Kat-90 self-assigned this Jun 14, 2024
Copy link
Contributor
@Kat-90 Kat-90 left a comment

Choose a reason for hiding this comment

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

Reviewed code and tested. All working fine when I rebase the branch on master as some changes to the test_data directory aren't included in the branch. One small comment.

lapse_rate_cube = forecast.copy()
with pytest.raises(NotImplementedError, match=msg):
SpotManipulation(subset_coord="wmo_id", apply_lapse_rate_correction=True)(
[forecast, lapse_rate_cube, neighbour_cube]
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't see a test for the code returning the whole cube untouched if subset_coord is None. I think this is worthy of a test because it's in a specific condition of the code, but I c 8000 an't tell if it's automatically tested for within one of the other tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, please remember to check out the acceptance test data:
metoppv/improver_test_data#46

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, please remember to check out the acceptance test data: metoppv/improver_test_data#46

This is what I did, but I rebased with master to get all the tests to pass. There has been an addition of a bias correction KGO since you opened the branch.

Unfortunately the link to the test you're trying to show me doesn't work.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Kat-90 Kat-90 assigned bayliffe and unassigned Kat-90 Jun 17, 2024
@bayliffe bayliffe assigned Kat-90 and unassigned bayliffe Jun 17, 2024
@Kat-90 Kat-90 assigned bayliffe and unassigned Kat-90 Jun 18, 2024
@Kat-90 Kat-90 merged commit 1b47d2a into metoppv:master Jun 18, 2024
9 checks passed
MoseleyS pushed a commit to MoseleyS/improver that referenced this pull request Aug 22, 2024
…ppv#2002)

* Add basic functionality to allow subsetting a spot-forecast cube using a neighbour cube via the spot-extraction CLI / SpotManipulation plugin.

* Add comment

* Add unit tests for spot forecast subsetting using the SpotManipulation plugin.

* Additional tests for spot subsetting.

* Add handling of None IDs and an associated test.

* Add handling for case where no spot forecasts remain after the subsetting.

* Add an acceptance test that demonstrated subsetting an existing spot forecast to the sites defined in a neighbour cube with valid IDs.

* Raise exception if lapse rate adjustment is attempted on existing spot forecast.

* Remove test I added for checking.
@bayliffe bayliffe added this to the IM2025.1/PS47 milestone Mar 10, 2025
@bayliffe bayliffe deleted the mobt689pt2 branch April 29, 2025 14:48
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
0