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

Fix to the wind vertical displacement adjustment implementation #1927

Merged
merged 5 commits into from
Jul 20, 2023

Conversation

bayliffe
Copy link
Contributor

This change addresses an issue in the dz adjustment of wind speeds. The leniency applied for finding a dz adjustment match in the ancillary did not span across midnight, meaning a 23Z forecast reference time was unable to use a 00Z forecast reference time with a leniency of +- 1 hour. This change simply adds a modulus about 24 hours to ensure the looping around to 00Z occurs as required.

The unit tests have been modified to span the midnight line to check that this works as expected.

Testing:

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

@bayliffe bayliffe changed the title Fix to the wind vertical displaement adjustment implementation Fix to the wind vertical displacement adjustment implementation Jul 20, 2023
@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #1927 (7c776ae) into master (523ae6f) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1927   +/-   ##
=======================================
  Coverage   98.37%   98.37%           
=======================================
  Files         122      122           
  Lines       11707    11707           
=======================================
  Hits        11517    11517           
  Misses        190      190           
Impacted Files Coverage Δ
improver/calibration/dz_rescaling.py 100.00% <ø> (ø)

Katie-Howard
Katie-Howard previously approved these changes Jul 20, 2023
Copy link
Contributor

@Katie-Howard Katie-Howard left a comment

Choose a reason for hiding this comment

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

I've looked through the changes and they seem fine to me. The tests all seem to pass, and the changes to the unit tests seem sensible. I'm happy with this 👍

Copy link
Contributor

@brhooper brhooper left a comment

Choose a reason for hiding this comment

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

The tests pass and the changes all look fine, including the change to test_apply_dz_rescaling to target a reference time hour leniency which spans midnight.

I think there is just one docstring which needs updating.

@@ -121,7 +121,7 @@ def _create_scaling_factor_cube(
Scaling factor cube.
"""
cubelist = iris.cube.CubeList()
for ref_hour in [3, 9]:
for ref_hour in [3, 12]:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the docstring needs updating to reflect this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

…fset of 0, is used before any other reference time is selected.
Copy link
Contributor

@brhooper brhooper left a comment

Choose a reason for hiding this comment

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

This looks good - thanks @bayliffe.

Copy link
Contributor

@Katie-Howard Katie-Howard left a comment

Choose a reason for hiding this comment

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

I'm happy with these changes - all the tests work and they look sensible 👍

@bayliffe bayliffe merged commit e1523c2 into metoppv:master Jul 20, 2023
10 checks passed
@bayliffe bayliffe self-assigned this Jul 20, 2023
@bayliffe bayliffe deleted the wind_dz_fix branch July 26, 2023 10:23
bayliffe added a commit to bayliffe/improver that referenced this pull request Jul 28, 2023
* upstream/master:
  Fix to the wind vertical displacement adjustment implementation (metoppv#1927)
  Add function which normalises input cubes according to a reference (metoppv#1919)
  Skip ECC bounds usage when converting probabilities to percentiles (metoppv#1926)
  Add CLIs to support rescaling of the forecast based on altitude difference (metoppv#1917)
  Changes to the modal code to increase the percentage to 30% and change the groupings to provide a more representative daily summary symbol. (metoppv#1925)
  Add plugins to support rescaling of the forecast based on altitude difference (metoppv#1916)
  Support conversion from percentiles to probabilities (metoppv#1924)
  Correct handling of reference time in weather_code plugin (metoppv#1920)
  Add CLI for clipping cubes (metoppv#1918)
  Update cbh ecc name (metoppv#1922)
  Updates Broadcast and expand_bounds in Combine Plugin (metoppv#1914)
  Mobt515 cloud base height spot extraction (metoppv#1911)
  MOBT-494: Cube title setting in weather symbol code (metoppv#1912)
  MOBT512-masking percentiles for cloud base height (metoppv#1908)
  Mobt 496 enforce forecast between references (metoppv#1907)
MoseleyS pushed a commit to MoseleyS/improver that referenced this pull request Aug 22, 2024
…ppv#1927)

* Ensure that the forecast reference time goes around the clock to pick up 00Z for 23Z within a 1-hour leniency.

* Modify unit tests to require seeking for a match across the midnight divide.

* Black formatting change.

* Update test doc-string

* Add an extra test to demonstrate that the exact reference time, an offset of 0, is used before any other reference time is selected.
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