Skip to content

Comments

Lighting in vicinity cell_method alignment for master#2296

Open
bayliffe wants to merge 9 commits intometoppv:masterfrom
bayliffe:lighting_cell_method_fix
Open

Lighting in vicinity cell_method alignment for master#2296
bayliffe wants to merge 9 commits intometoppv:masterfrom
bayliffe:lighting_cell_method_fix

Conversation

@bayliffe
Copy link
Contributor

@bayliffe bayliffe commented Feb 5, 2026

In the global data lightning diagnostic that is created within improver we manually create the cell method.
The method is stated as "Sum" with a capital s, which doesn't match the lower case "sum" in the UK model diagnostics with which is blended. When the cubes are combined before merging the data the cell_methods are checked in the MergeCubes plugin and they all get thrown away.

Additionally, following the generalisation of the vicinity method to allow for mins, means etc. as well as maxes, an additional cell method is added to specify the form of the vicinity that has been applied. When vicinities are applied via the threshold step these cell methods are not added. ENGLUK lightning in vicinity data uses the vicinity CLI and thus gets this extra "area" cell method that is not present on the data from UKVX and ENUKX. This is a further source of difference between the two.

This PR:

  • sets the manually created cell_method to use lowercase "sum" to match the other diagnostics.
  • provides an option to omit the cell_method when applying the vicinity CLI. This is not desirable in general, but allows us to align the metadata for lightning without having to modify the cell methods of all other vicinity diagnostics by modifying the threshold applied vicinities.

Associated suite PR: https://github.com/MetOffice/improver_suite/pull/2623
Associated acceptance test data: metoppv/improver_test_data#121

Testing:

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

Testing in the suites

Metadata in model suites

The tables below demonstrate that the metadata is now consistent across the various model suites by the time we get to the latestlevel2 feeding steps (blendcycles). The 3-hour diagnostic differs at the combine step as it feeds again from the standardise step before then having the cell method modified to the expected once again.

lightning1h (T+12 as an example)

Model Step Cell method
imukvx fetchlevel1 (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=()),)
imukvx standardise (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=()),)
imenukx fetchlevel1 (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=()),)
imenukx standardise (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=()),)

lightningvic1h (T+12 as an example)

Model Step Cell method
imukvx threshold (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imukvx nbhood (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imukvx recfilter (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imukvx blendcycles (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx threshold (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx nbhood (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx recfilter (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx blendcycles (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk lightning_filter (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk regrid (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk vicinity (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk nbhood (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk realization_collapse (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk blendcycles (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk recfilter (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)

lightningvic3h (T+12 as an example)

Model Step Cell method
imukvx combine (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=()),)
imukvx threshold (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imukvx nbhood (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imukvx recfilter (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imukvx blendcycles (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx combine (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=()),)
imenukx threshold (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx nbhood (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx recfilter (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imenukx blendcycles (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk combine (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk regrid (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk vicinity (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk nbhood (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk realization_collapse (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk blendcycles (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
imengluk recfilter (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)

Metadata in blending suite

lightningvic1h (T+12 as an example)

Model Step Cell method
immix latestblend (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
immix spot_extract (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)

lightningvic3h (T+12 as an example)

Model Step Cell method
immix latestblend (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
immix spot_extract (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)

lightningvic3h (T+122 as an example beyond the UK model contributions)

Model Step Cell method
immix latestblend (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)
immix spot_extract (CellMethod(method='sum', coord_names=('time',), intervals=(), comments=('of number_of_lightning_flashes_per_unit_area',)),)

…he other model cell methods and they don't all get thrown away.
…xclude the addition of a cell method. Note that this change will conflict with master as this code has been extensively modified by the Bureau.
@bayliffe bayliffe changed the title Correct type in lightning cell method Lighting in vicinity cell_method alignment for master Feb 6, 2026
gavinevans
gavinevans previously approved these changes Feb 16, 2026
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 👍

This looks fine. Acceptance tests pass once this PR is merged with #2297, and these two improver_test_data PRs are merged together: metoppv/improver_test_data#121, metoppv/improver_test_data#122.

MoseleyS
MoseleyS previously approved these changes Feb 17, 2026
@bayliffe bayliffe dismissed stale reviews from MoseleyS and gavinevans via 8cff506 February 19, 2026 09:44
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