Skip to content

Nearest neighbour regrid in lfric2um - #806

Merged
James Bruten (james-bruten-mo) merged 20 commits into
MetOffice:mainfrom
mo-lottieturner:non_bilinear_weights_lfric2um
Oct 15, 2026
Merged

James Bruten (james-bruten-mo) merged 20 commits into
MetOffice:mainfrom
mo-lottieturner:non_bilinear_weights_lfric2um

Conversation

@mo-lottieturner

@mo-lottieturner Lottie Turner (mo-lottieturner) commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Summary

This ticket will need a new file added to $BIG_DATA_DIR
It will also add a new lfric2um kgo set

Sci/Tech Reviewer: Steve Mullerworth (@stevemullerworth)
Code Reviewer: allynt

This PR adds to LFRic2UM the functionality to regrid by the nearest neighbour method (as opposed to bilinear interpolation). I have set it up so that all fields that have a land-sea mask use this method for the moment, until such time as functionality for masked regridding is implemented [link to PR to go here].

The stashcodes for the relevant fields (and their respective lfric names) are

Stashcode LFRic name
279 soil_sat_frac
278 water_table
281 wetness_under_soil
213 surface_conductance
49 sea_ice_temperature

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

Testing

  • I have tested this change locally, using the LFRic Apps rose-stem suite
  • If any tests fail (rose-stem or CI) the reason is understood and acceptable (e.g. kgo changes)
  • I have added tests to cover new functionality as appropriate (e.g. system tests, unit tests, etc.)
  • Any new tests have been assigned an appropriate amount of compute resource and have been allocated to an appropriate testing group (i.e. the developer tests are for jobs which use a small amount of compute resource and complete in a matter of minutes)

trac.log

Test Suite Results - lfric_apps - t806_nearest_neighbour/run12

Suite Information

Item Value
Suite Name t806_nearest_neighbour/run12
Suite User charlotte.turner
Workflow Start 2026-09-24T14:58:38
Groups Run azspice_developer', 'lfric2um_azspice
Dependency Reference Main Like
casim MetOffice/casim@2026.07.1 True
jules MetOffice/jules@c22aeea True
lfric_apps mo-lottieturner/lfric_apps@non_bilinear_weights_lfric2um False
lfric_core MetOffice/lfric_core@220a00c True
moci MetOffice/moci@2026.07.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@77a5166 True
socrates MetOffice/socrates@2026.07.1 True
socrates-spectral MetOffice/socrates-spectral@2026.07.1 True
ukca MetOffice/ukca@c372b36 True

Task Information

❌ failed tasks - 2
Task State
rose_ana_lfricinputs_lfric2um-nwp_gal9-C48L70_N48L70_azspice_gnu_fast-debug-64bit failed
rose_ana_lfricinputs_lfric2um-nwp_gal9-C48L70_N48L70_azspice_gnu_full-debug-64bit failed
✅ succeeded tasks - 602
⌛ waiting tasks - 1
Task State
housekeep_azspice waiting
# Test Suite Results - lfric_apps - t806_nearest_neighbour/run13

Suite Information

Item Value
Suite Name t806_nearest_neighbour/run13
Suite User charlotte.turner
Workflow Start 2026-09-24T15:06:19
Groups Run ex1a_developer', 'lfric2um_ex1a', 'lfric2um_ex1a_weekly
Dependency Reference Main Like
casim MetOffice/casim@2026.07.1 True
jules MetOffice/jules@c22aeea True
lfric_apps mo-lottieturner/lfric_apps@non_bilinear_weights_lfric2um False
lfric_core MetOffice/lfric_core@220a00c True
moci MetOffice/moci@2026.07.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@77a5166 True
socrates MetOffice/socrates@2026.07.1 True
socrates-spectral MetOffice/socrates-spectral@2026.07.1 True
ukca MetOffice/ukca@c372b36 True

Task Information

❌ failed tasks - 2
Task State
rose_ana_lfricinputs_lfric2um-nwp_gal9-C48L70_N48L70_ex1a_gnu_fast-debug-64bit failed
rose_ana_lfricinputs_lfric2um-nwp_gal9-C48L70_N48L70_ex1a_gnu_full-debug-64bit failed
✅ succeeded tasks - 642
⌛ waiting tasks - 1
Task State
housekeep_ex1a waiting

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

Performance Impact

  • Performance of the code has been considered and, if applicable, suitable performance measurements have been conducted

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Documentation

  • Where appropriate I have updated documentation related to this change and confirmed that it builds correctly

PSyclone Approval

  • If you have edited any PSyclone-related code (e.g. PSyKAl-lite, Kernel interface, optimisation scripts, LFRic data structure code) then please contact the HPC Optimisation Team

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

(Please alert the code reviewer via a tag when you have approved the SR)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • CLA compliance has been confirmed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Performance impact is acceptable

Lottie Turner (mo-lottieturner) added a commit to mo-lottieturner/lfric_apps that referenced this pull request Sep 24, 2026
@mo-lottieturner Lottie Turner (mo-lottieturner) added the KGO This PR contains changes to KGO label Sep 24, 2026
@mo-lottieturner

Lottie Turner (mo-lottieturner) commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Masked field regridded with nearest neighbour method
image
Compare with below, which is what a masked field looks like when regridded with bilinear interpolation (note the scale)
image

@mo-lottieturner

Copy link
Copy Markdown
Contributor Author

This ticket uses the kgo file from the C48 um2lfric nwp_gal9 job as the start dump: $UMDIR/standard_jobs/lfricinputs/kgo/lfricinputs_um2lfric-nwp_gal9-N320L70_C48L70_azspice_gnu_full-debug-64bit/vn3.2_t565/checkpoint_um2lfric_000001.nc, which will need to be added to $BIG_DATA_DIR/lfric2um/apps3.2 and named nwp-gal9_N320L70_C48L70.nc.

As the kgo lives on azspice and not ex1a, the ex1a trac.log has been generated with the equivalent kgo file that is used by the ex1a tasks, hence the separate trac.logs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please provide a slightly more comprehensive description of the change in the PR template.

Implementation is in line with existing code, so sci/tech all OK subject to feedback being dealt with. I believe my role is to provide a tech, more than sci, review as the scientific result is not the final answer and subject to further change (it would be good for the PR description to discuss these aspects).

Spotted one minor spelling error while going through the change.

Comment thread applications/lfricinputs/source/lfric2um/lfric2um_regrid_weights_mod.f90 Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Now approved

@github-actions
github-actions Bot requested a review from allynt October 6, 2026 10:38

@allynt allynt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code looks good. Just have a couple of questions.

Comment thread applications/lfricinputs/source/lfric2um/lfric2um_regrid_weights_mod.f90 Outdated
@github-actions github-actions Bot added the cla-modified The CLA has been modified as part of this PR - added by GA label Oct 13, 2026
@mo-lottieturner

Copy link
Copy Markdown
Contributor Author

Changed log level - also reordered task defs in tasks_lfric2um.cylc so the bigger job is after the smaller job

@github-actions github-actions Bot removed the cla-modified The CLA has been modified as part of this PR - added by GA label Oct 13, 2026
Lottie Turner (mo-lottieturner) added a commit to mo-lottieturner/lfric_apps that referenced this pull request Oct 13, 2026
Lottie Turner (mo-lottieturner) added a commit to mo-lottieturner/lfric_apps that referenced this pull request Oct 13, 2026
Lottie Turner (mo-lottieturner) added a commit to mo-lottieturner/lfric_apps that referenced this pull request Oct 13, 2026

@allynt allynt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My concerns have been addressed. This looks good to me.

@james-bruten-mo
James Bruten (james-bruten-mo) merged commit ee14f75 into MetOffice:main Oct 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

KGO This PR contains changes to KGO

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants