Skip to content

Commit

Permalink
Minor edit to include the influence of day weighting when using the i…
Browse files Browse the repository at this point in the history
…ntensity categorisation.
  • Loading branch information
gavinevans committed Aug 20, 2024
1 parent f1756bd commit de04628
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion improver/wxcode/modal_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def process(self, cubes: CubeList) -> Cube:
if len(cube.coord("time").points) == 1:
result = cube
else:
original_cube = cube.copy()
original_cube = self._emphasise_day_period(cube.copy())
cube = self._consolidate_intensity_categories(cube)
cube = self._emphasise_day_period(cube)

Expand Down
7 changes: 7 additions & 0 deletions improver_tests/wxcode/wxcode/test_ModalFromGroupings.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ def test_expected_values_ignore_intensity(
# least 1/(1+2) * 11 = 3.67 codes must be wet in order to produce a wet code.
# As 5 codes are wet, a wet code is produced.
([1, 1, 1, 1, 1, 17, 17, 17], 2, 2, 4, 7, 8, False, 17),
# Mixed precipitation. Day weighting results in the heavy rain (15) codes
# doubling. This leads to 4 heavy rain codes vs 4 light rain codes with the
# heavy rain codes taking precedence.
([10, 11, 12, 15, 15, 12, 12, 10, 3, 3, 3], 1, 2, 0, 5, 11, False, 15),
# Similar to the example above with the intensity categorisation included.
# Heavy rain (15) code is still the result.
([10, 11, 12, 15, 15, 12, 12, 10, 3, 3, 3], 1, 2, 0, 5, 11, True, 15),
# All precipitation is frozen. Ignoring the intensities means that a
# day weighting of 2 results in 8 sleet codes and 8 light snow shower codes.
# A wet bias of 2 means that at least 1/(1+2) * 16 = 5.33 codes must be wet
Expand Down

0 comments on commit de04628

Please sign in to comment.