Skip to content

#474: LFRic-Nudging: Part-A: Introduce ability to read nudging datafiles : vn3.1.1 read nudging data#474

Open
Mohit Dalvi (mcdalvi) wants to merge 15 commits into
MetOffice:mainfrom
mcdalvi:vn3.1.1_read_nudging_data
Open

#474: LFRic-Nudging: Part-A: Introduce ability to read nudging datafiles : vn3.1.1 read nudging data#474
Mohit Dalvi (mcdalvi) wants to merge 15 commits into
MetOffice:mainfrom
mcdalvi:vn3.1.1_read_nudging_data

Conversation

@mcdalvi
Copy link
Copy Markdown
Contributor

@mcdalvi Mohit Dalvi (mcdalvi) commented Apr 30, 2026

PR Summary

Sci/Tech Reviewer: Thomas Bendall (@tommbendall)
Code Reviewer: Matthew Hambley (@MatthewHambley)

This PR introduces the ability to read in datafiles that will be used for Nudging the Momentum models (Ref: Nudging NWP to AI/ML models - possibly targeting PS49).
The handling of Nudging data is modelled on existing lateral boundary condition handling in LFRic since they are both required to be interpolated from high time resolution file data on every model timestep.
Nudging changes summary:

  • Ability to read in nudging data for temperature, U-wind, V-wind and Log surface pressure (required for vertical remapping to model levels).

  • New [namelist:nudging], which will be active when theta or wind are 'forced by nudging' (in namelist:external_forcing). A corresponding upgrade_macro to add the namelist and I/O related items.

  • Introduce routine create_nudging_fields to create the nudging input fields as '2-D with user-specified (nudge_data) levels'. Corresponding grid_def_nudging.xml and grid_def_nudging_coarse.xml added to lfric_atm/metadata/.

  • Introduce ability to read in nudging data on native ('dynamics') or a coarser grid, with rationalising of routines that create the model fields ('make_spec', 'create_model_data') to accept both aerosol and nudging coarse mesh definitions.

  • Note that the above requires a LFRIC_CORE change to allow defining 3-D coarse grid fields as ''multigrid_ll'' x ndata.

  • Define a nudging_time_axis which will be populated based on the actual number of time records in the specified nudging file.

  • Introduce two new rose-stem tests lfric_atm_nwp_gal9_nudging-C48 that reads nudging files on the model grid and lfric_atm_nwp_gal9_nudging_coarse-C48 that reads in data at a lower resolution (C12) grid. This currently uses nudging data created from ERA5 source, but aim is to expand this to AIFS and other models.

  • At this stage the reference fields are only made available to LFRic and do not modify temperature/ winds.

  • linked #369: Allow coarse-grid fields with ndata levels: vn3.1 read coarse 2d lfric_core#369

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)

Test Branch: test_vn31_nudging_data

trac.log

Test Suite Results - lfric_apps - test_vn31_nudging_data/run2

Suite Information

Item Value
Suite Name test_vn31_nudging_data/run2
Suite User mohit.dalvi
Workflow Start 2026-05-14T14:06:15
Groups Run developer', 'lfric_atm_nudging
Dependency Reference Main Like
casim MetOffice/casim@2026.03.2 True
jules MetOffice/jules@2026.03.2 True
lfric_apps mcdalvi/lfric_apps@test_vn31_nudging_data False
lfric_core mcdalvi/lfric_core@vn3.1_read_coarse_2d True
moci MetOffice/moci@2026.03.2 True
SimSys_Scripts MetOffice/SimSys_Scripts@cab3315 True
socrates MetOffice/socrates@2026.03.2 True
socrates-spectral MetOffice/socrates-spectral@2026.03.2 True
ukca MetOffice/ukca@1cdb9c2 True

Task Information

✅ succeeded tasks - 1197

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)

VsCode - code completion/ snippets.

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 TCD 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

@mcdalvi Mohit Dalvi (mcdalvi) requested review from Matthew Hambley (MatthewHambley) and removed request for a team April 30, 2026 16:20
@mcdalvi Mohit Dalvi (mcdalvi) changed the title LFRic-Nudging: Part-A: Introduce ability to read nudging datafiles : vn3.1.1 read nudging data #74: LFRic-Nudging: Part-A: Introduce ability to read nudging datafiles : vn3.1.1 read nudging data Apr 30, 2026
@mcdalvi Mohit Dalvi (mcdalvi) changed the title #74: LFRic-Nudging: Part-A: Introduce ability to read nudging datafiles : vn3.1.1 read nudging data #474: LFRic-Nudging: Part-A: Introduce ability to read nudging datafiles : vn3.1.1 read nudging data Apr 30, 2026
@DanStoneMO
Copy link
Copy Markdown
Contributor

Is there any chance main could be merged into this branch? I'm currently unable to test the changes with JEDI due to the conflicts

@mcdalvi Mohit Dalvi (mcdalvi) marked this pull request as draft May 1, 2026 09:45
@mcdalvi
Copy link
Copy Markdown
Contributor Author

Apologies, I was not aware creating a PR triggers all this activity ! I have changed it to draft till all my testing is complete.

@mcdalvi Mohit Dalvi (mcdalvi) added Linked Core This PR is linked to a MetOffice/lfric_core PR KGO This PR contains changes to KGO macro This PR contains a metadata upgrade macro labels May 1, 2026
…at are defined in source code; implement upgrade macro
…2bit as done for other azspice runs; remove unused additions to ancil reading code
@mcdalvi
Copy link
Copy Markdown
Contributor Author

Mohit Dalvi (mcdalvi) commented May 14, 2026

Merged main into branch at [08455b0](url).

Sample plots

Comparing data from ERA file (left) with lfric_atm_nudging diagnostic .
*Note that ERA data are single time snapshots while output fields are interpolated between ERA snapshots to model timestep and then averaged before output.
nudge_T_C48_era_vs_model
nudge_U_C48_era_vs_model
nudge_V_C48_era_vs_model

@mcdalvi
Copy link
Copy Markdown
Contributor Author

Mohit Dalvi (mcdalvi) commented May 15, 2026

Input test files for $BIGDATA

The input files for the lfric_atm_nwp_gal9_nudging_xx tests have been generated using ERA5 reanalysts data provided by by the Copernicus Climate Change Service distributed via the Copernicus Data Service. Dataset information, including usage terms can be found here: https://cds.climate.copernicus.eu/datasets/reanalysis-era5-complete?tab=documentation

The files proposed to be added to $BIGDATA are:
/data/users/mohit.dalvi/lfric/data/nudge/TomB/era/C12/era5_nudge_L137_C12_2021032400-2706.nc
/data/users/mohit.dalvi/lfric/data/nudge/TomB/era/C48/era5_nudge_L137_C48_MG_2021032400-2706.nc

Both the files contain the following attributes:

		:licence = "The ERA5 data from Copernicus Climate Change Service is licensed under the CC-BY licence. 
Highlights and key features of the licence are here: https://creativecommons.org/licenses/by/4.0/. 
Full legal text is provided here:https://creativecommons.org/licenses/by/4.0/legalcode" ;

		:attribution = "Generated using or contains modified Copernicus Climate Change Service information .
 Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus
 information or data it contains." ;

		:references = "Hersbach, H. et al, (2017): Complete ERA5 from 1940: Fifth generation of ECMWF
 atmospheric reanalyses of the global climate. Copernicus Climate Change Service (C3S) Data Store (CDS). DOI: 
10.24381/cds.143582cf" 

Copy link
Copy Markdown
Contributor

@iboutle iboutle left a comment

Choose a reason for hiding this comment

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

Hi Mohit

I know this isn't fully ready yet, but I'm on leave next week so wanted to give some comments and code-owner approval so you can get this into code review by next Friday. Hopefully nothing too challenging, but a few requests and suggestions below.

Cheers

Ian

Comment thread applications/lfric_atm/metadata/lfric_dictionary.xml
Comment thread rose-stem/app/lfric_atm/file/file_def_diags_gal_nwp_nudging.xml Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era.conf Outdated
Comment thread science/gungho/rose-meta/lfric-gungho/versions.py
Comment thread science/gungho/rose-meta/lfric-gungho/HEAD/rose-meta.conf
Comment thread applications/lfric_atm/metadata/field_def_diags.xml
Comment thread science/gungho/rose-meta/lfric-gungho/HEAD/rose-meta.conf Outdated
Comment thread science/gungho/source/driver/gungho_init_fields_mod.X90 Outdated
…definition and diagnostic list - this requires creating the fields in main%none
Comment thread rose-stem/site/meto/groups/groups_lfric_atm.cylc 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.

Thanks

Copy link
Copy Markdown
Contributor

@DanStoneMO DanStoneMO left a comment

Choose a reason for hiding this comment

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

Tested this and can confirm this works fine with JEDI, no linked JEDI PR will be needed

<axis id="lw_bands_radiation_levels" name="lw_bands_radiation_levels" />
<axis id="photolysis_pathways" name="photolysis_pathways" />
<axis id="photol_species" name="photol_species" />
<axis id="photol_species" name="photol_species" />
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.

Only thing to note from me is this rogue space here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks DanStoneMO . I have fixed that in my copy

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.

Science Review
This PR adds the technical infrastructure for nudging to ERA or AIFS data, and will be followed by a PR to add the science to perform the nudging itself (including only nudging certain length scales).

Thanks so much for this Mohit -- it looks great. I have two more major thoughts, and then a handful of other suggestions that I've commented in the code.

  1. Do you think we should reorder the ERA ancil data vertically before we add it to BIG_DATA_DIR? (I'm assuming we haven't done this yet)... That would make the vertical interpolation more efficient when we get to that. If that's too much work before the deadline then we can potentially do it later when adding AIFS data?
  2. I have an annoying suggestion to change the settings of the nudging-era-coarse test, which is to set the aerosols to be on the dynamics mesh rather than keeping them on a coarse mesh. I just thought this would be a bit cleaner in the test-suite, so have added suggestions on how to do this

Comment thread applications/lfric_atm/metadata/axis_def_main.xml Outdated
Comment thread rose-stem/app/lfric_atm/file/iodef_gal_nwp_coarse_aero.xml Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era.conf Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf Outdated
Comment thread rose-stem/app/lfric_atm/opt/rose-app-nudging-era-coarse.conf Outdated
…e mesh only for nudging. Use ERA files inverted from original top-bottom order (level=1=top) to bottom-top order
@mcdalvi
Copy link
Copy Markdown
Contributor Author

Thomas Bendall (@tommbendall) I have reversed the ERA file data using 'ncpdq -a hybrid' and using the new files in the tests now.
Also reveted nudging_era_coarse test to use coarse grid only for Nudging. 642225b

Tests underway.

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 Linked Core This PR is linked to a MetOffice/lfric_core PR macro This PR contains a metadata upgrade macro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants