Skip to content

Commit

Permalink
Updates following review.
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinevans committed Aug 13, 2024
1 parent cf5e063 commit cadbddc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion improver/wxcode/modal_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ def _promote_time_coords(cube: Cube, template_cube: Cube) -> Cube:
Args:
cube: Cube with time coordinates.
template_cube: Cube to provide coordinates associated with the time
coordinate that will be added to the output cube.
Returns:
A cube with a time dimension coordinate and other time-related coordinates
Expand Down Expand Up @@ -565,6 +567,7 @@ def counts_per_category(data: np.ndarray, bin_max: int) -> np.ndarray:
Args:
data: Array where occurrences of each possible integer value between 0
and data.max() will be counted.
bin_max: Integer defining the number of categories expected.
Returns:
An array of counts for the occurrence of each category within each row.
Expand Down Expand Up @@ -702,7 +705,15 @@ def _get_most_likely_following_grouping(
def _set_blended_times(cube: Cube, result: Cube) -> None:
"""Updates time coordinates so that time point is at the end of the time bounds,
blend_time and forecast_reference_time (if present) are set to the end of the
bound period and bounds are removed, and forecast_period is updated to match."""
bound period and bounds are removed, and forecast_period is updated to match.
The result cube is modified in-place.
Args:
cube: Cube containing metadata on the temporal coordinates that will be
used to add the relevant metadata to the result cube.
result: Cube containing the computed modal weather code. This cube will be
updated in-place.
"""
result.coord("time").points = cube.coord("time").points[-1]
result.coord("time").bounds = [
cube.coord("time").bounds[0][0],
Expand Down
4 changes: 3 additions & 1 deletion improver_tests/wxcode/wxcode/test_ModalFromGroupings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@
],
[3, 4, 3, 7],
),
# Tied dry weather codes. The highest index weather code should be selected.
# Tied dry weather codes. The day version of the highest index weather code
# should be selected i.e. a partly cloudy night code (2) becomes a partly
# cloudy day code (3).
([0, 0, 0, 2, 2, 2, 7, 7], 3),
),
)
Expand Down

0 comments on commit cadbddc

Please sign in to comment.