8000 Changes to the modal code to increase the percentage to 30% and alter some of the groupings to give a better daily summary symbol. by Katie-Howard · Pull Request #1925 · metoppv/improver · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Changes to the modal code to increase the percentage to 30% and alter some of the groupings to give a better daily summary symbol. #1925

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 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions improver/wxcode/modal_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _group_codes(modal: Cube, cube: Cube):
@staticmethod
def mode_aggregator(data: ndarray, axis: int) -> ndarray:
"""An aggregator for use with iris to calculate the mode along the
specified axis. If the modal value selected comprises less than 10%
specified axis. If the modal value selected comprises less than 30%
of data along the dimension being collapsed, the value is set to the
UNSET_CODE_INDICATOR to indicate that the uncertainty was too high to
return a mode.
Expand All @@ -169,7 +169,7 @@ def mode_aggregator(data: ndarray, axis: int) -> ndarray:
# Aggregation coordinate is moved to the -1 position in initialisation;
# move this back to the leading coordinate
data = np.moveaxis(data, [axis], [0])
minimum_significant_count = 0.1 * data.s 8000 hape[0]
minimum_significant_count = 0.3 * data.shape[0]
mode_result, counts = stats.mode(CODE_MAX - data, axis=0)
mode_result[counts < minimum_significant_count] = (
CODE_MAX - UNSET_CODE_INDICATOR
Expand Down
3 changes: 2 additions & 1 deletion improver/wxcode/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@
GROUPED_CODES = {
"snow": [23, 24, 26, 27],
"sleet": [17, 18],
"rain": [10, 12, 14, 15],
"rain": [10, 11, 12, 14, 15],
"convection": [20, 21, 29, 30],
"visibility": [5, 6],
}


Expand Down
2 changes: 1 addit 8000 ion & 1 deletion improver_tests/acceptance/SHA256SUMS
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ bcd90ab1d28fd736d4a3d9e481374348438d7716b543f9c7d435b003ba10c344 ./wxcode-modal
973c60900aa526818e7119ed016997170055017ee1bbda279b9e640750f96f61 ./wxcode-modal/gridded_input/20201209T1600Z-weather_symbols-PT01H.nc
571bff58be29197e5f946745ed565889ec81499521c38d8f7286488079afb46d ./wxcode-modal/gridded_input/20201209T1700Z-weather_symbols-PT01H.nc
2af4455b0ba7c4124e49eb1ff004e770b6239a9e2e1513f60ba4db3f0beb02cf ./wxcode-modal/gridded_input/20201209T1800Z-weather_symbols-PT01H.nc
6378828971f90a819894cf6afa3b4abea427d7c270a3ff1dcb00610c7d41a288 ./wxcode-modal/gridded_input/kgo.nc
3d9ebd58773193d27a0889853f0257cf852bf603abee657d0e2fcec4bfcca213 ./wxcode-modal/gridded_input/kgo.nc
96a8462af571f06dbd8b91a7a90aaef403eefd2b73929a5c6d8a3fbb01159aca ./wxcode-modal/gridded_ties/20201209T0700Z-weather_symbols-PT01H.nc
9f64c7a8aa7cf0e87799f96ebffe1e449e1f5174fb583d44f2479e085672dc84 ./wxcode-modal/gridded_ties/20201209T0800Z-weather_symbols-PT01H.nc
c698b9599219fe89374a2565e55a374d9236904c9dd99a2ae61b5416506e98d3 ./wxcode-modal/gridded_ties/20201209T0900Z-weather_symbols-PT01H.nc
Expand Down
14 changes: 9 additions & 5 deletions improver_tests/wxcode/wxcode/test_ModalCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,23 @@ def wxcode_series_fixture(
# day code (10) to be returned.
([1, 1, 10, 10, 9], 10),
# No clear representative code. Falls back to grouping, which
# consolidates the codes containing rain (10, 12, 14, 15) and yields
# consolidates the codes containing rain (10, 11, 12, 14, 15) and yields
# the least significant of these that is present (10).
([1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15], 10),
# No clear representative code. Falls back to grouping, which
# consolidates the codes containing rain (10, 12, 14, 15) and yields
# the least significant of these which is present (12); the light
# consolidates the codes containing rain (10, 11, 12, 14, 15) and yields
# the least significant of these which is present (11); the light
# shower code (10) is not present, so will not be picked.
([1, 3, 4, 5, 6, 7, 8, 16, 11, 12, 14, 15], 12),
([1, 3, 4, 5, 6, 7, 8, 16, 11, 12, 14, 15], 11),
# No clear representative code. This falls back to grouping,
# consolidates the codes containing visibility (5, 6) and yields
# the least significant of these which is present (5).
([5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 8, 7, 7, 7, 7], 5),
# An extreme edge case in which all the codes across time for a site
# are different. All the codes fall into different groups and cannot be
# consolidated. In this case the most significant weather from the whole
# set is returned. In this case that is a light snow shower (23).
([1, 3, 4, 5, 6, 7, 8, 10, 11, 17, 20, 23], 23),
([1, 3, 4, 5, 7, 8, 10, 17, 20, 23], 23),
),
)
def test_expected_values(wxcode_series, expected):
Expand Down
0