Skip to content

Add an io_value type for integers#326

Open
Steve Mullerworth (stevemullerworth) wants to merge 11 commits intoMetOffice:mainfrom
stevemullerworth:checkpoint_seed
Open

Add an io_value type for integers#326
Steve Mullerworth (stevemullerworth) wants to merge 11 commits intoMetOffice:mainfrom
stevemullerworth:checkpoint_seed

Conversation

@stevemullerworth
Copy link
Copy Markdown
Collaborator

@stevemullerworth Steve Mullerworth (stevemullerworth) commented Apr 10, 2026

PR Summary

Sci/Tech Reviewer: allynt
Code Reviewer: Pierre Siddall (@Pierre-siddall)

Currently, support for storing real arrays in the checkpoint dump is provided by the io_value_type and associated support routines in the LFRic-XIOS component. This change adds support for storing and checkpointing integer arrays.

As it changes the existing API, a linked MetOffice/lfric_apps#427 PR must be committed alongside this one.

As XIOS does not have an API for writing integer data, integer values are converted to dp_xios which would normally be a real64 value. This is accurate for all int32 numbers, but would not be should dp_xios ever be real32 (precision is insufficient for integer values greater than or equal to 2 to the power 24). The unit tests were written to check for this possibility.

Note on implementation 1: Currently, io_value_type is hardwired to r_def which can be real64 or real32 depending on the model configuration. Therefore, r_def is explicitly stated in the updated read/write API in the LFRic-XIOS component. Like with integers, there is a conversion to dp_xios which would have no impact on values whether r_def is 32-bit or 64-bit.

Note on implementation 2: The writing/reading of fields of different types/kinds is done through a single generic routine, such as write_field_generic, which includes a select type to differentiate the types/kinds. This setup is possible because the write_interface API in the common field_parent_type relates to the field_parent_proxy rather than the field_parent_type. As the IO value types do not have an equivalent proxy, the analogous write interface must refer to the specific object itself. In other words, the integer and r_def read and write interfaces take the actual integer_io_value_type or io_value_type as arguments, requiring the code to define specific subroutines for reading/writing.

As the read and write APIs should have different intent (the write interface should have intent(in)), the existing abstract interface that was shared has been split into two.

As indicated above, the change also adds some unit tests for the LFRic-XIOS capabilities for both real and integer arrays as previously no io_value testing existed. During this work, it was noted that the test data was not being allocated correctly, so this was tidied.

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 Core rose-stem suite
  • If required (e.g. API changes) I have also run the LFRic Apps test suite using this branch
  • 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_core - core_chkpt_seed/run2

Suite Information

Item Value
Suite Name core_chkpt_seed/run2
Suite User steve.mullerworth
Workflow Start 2026-04-10T13:48:02
Groups Run developer
Dependency Reference Main Like
lfric_core stevemullerworth/lfric_core@checkpoint_seed False
SimSys_Scripts MetOffice/SimSys_Scripts@2025.12.1 True

Task Information

✅ succeeded tasks - 382

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

@stevemullerworth Steve Mullerworth (stevemullerworth) added enhancement New feature or request Linked Apps This PR is linked to a MetOffice/lfric_apps PR labels May 1, 2026
@stevemullerworth Steve Mullerworth (stevemullerworth) marked this pull request as ready for review May 1, 2026 10:31
@github-actions github-actions Bot requested a review from allynt May 1, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Linked Apps This PR is linked to a MetOffice/lfric_apps PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants