Skip to content

2025.12.1 drivers x3 port#50

Open
Harry Shepherd (harry-shepherd) wants to merge 4 commits into
MetOffice:mainfrom
harry-shepherd:2025.12.1_drivers_x3_port
Open

2025.12.1 drivers x3 port#50
Harry Shepherd (harry-shepherd) wants to merge 4 commits into
MetOffice:mainfrom
harry-shepherd:2025.12.1_drivers_x3_port

Conversation

@harry-shepherd

@harry-shepherd Harry Shepherd (harry-shepherd) commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Code Reviewer: Sam Clarke-Green (@t00sa)

There is an aim to move all NGMS workflows to use XIOS3 (version 3 of the XML IO server). As part of the control of the coupled model, the XIOS driver contains lines to ensure that the iodef.xml control file is set up correctly to run a coupled model. However a variable name has changed between the XIOS2/XIOS2.5 versions, and the XIOS3 versions.

This is further complicated by the fact that the coupled model drivers need to deal with these earlier versions for use with the UM based coupled model used in both climate and operational NWP workflows.

I have modified the XIOS driver, to set the control variable to:

  • oasis_codes_id for non-XIOS3 runs
  • clients_code_id for XIOS3 runs.

XIOS3 based runs must specify an environment variable XIOS_VERSION=3. This defaults to 2 in the case of not being set.

This change has been tested in XIOS2 mode with the lfric_coupled test in LFRic apps trunk, and in the same test in the XIOS3 prototype test in the branch of LFRic apps used in tcd-XIOS3-extras/issue/49

By merging main in the branch, I could test using the drivers group of MOCI rose-stem.

Code Quality Checklist

(Some checks are automatically carried out via the CI pipeline)

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid undertanding and enhance the
    readability of the code
  • My changes generate no new warnings

Testing

  • I have tested this change locally, using the Moci rose-stem suite
  • If any tests fail (rose-stem or CI) the reason is understood and
    acceptable (eg. kgo changes)
  • I have added tests to cover new functionality as appropriate (eg. system
    tests, unit tests, etc.)

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

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

@harry-shepherd Harry Shepherd (harry-shepherd) marked this pull request as ready for review April 8, 2026 10:37

@t00sa Sam Clarke-Green (t00sa) left a comment

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.

See suggestion inline. It's a style question, so it's up to you whether you want to go with it or not

Comment on lines +69 to +76
if xios_version == '3':
# The appropriate variable is clients_code_id
line = '<variable id="clients_code_id" type="string" >' \
+ oasis_components+'</variable>'
else:
# For XIOS2/2.5 the appropriate variable is oasis_codes_id
line = '<variable id="oasis_codes_id" type="string" >' \
+ oasis_components+'</variable>'

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.

If you don't need to pad the IDs to get them to line up and you're happy to go with f-strings, you can simplify things a bit:

Suggested change
if xios_version == '3':
# The appropriate variable is clients_code_id
line = '<variable id="clients_code_id" type="string" >' \
+ oasis_components+'</variable>'
else:
# For XIOS2/2.5 the appropriate variable is oasis_codes_id
line = '<variable id="oasis_codes_id" type="string" >' \
+ oasis_components+'</variable>'
# Variable name changes at version 3
vname = "clients_code_id" if xios_version == '3' else "oasis_codes_id"
line = f'<variable id="{vname}" type="string" >{oasis_components}</variable>'

@t00sa Sam Clarke-Green (t00sa) left a comment

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.

Not sure where we are with this - I suspect I might have pressed the comment button rather than the changes one! Can you take a look at the comments in-line and see what you think?

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.

Coupled model drivers compatibility with XIOS3

4 participants