Skip to content

Add additional si3 fields to PostProc app - #73

Merged
Pierre Siddall (Pierre-siddall) merged 9 commits into
MetOffice:mainfrom
ericaneininger:add_si3_fields
Oct 29, 2026
Merged

Pierre Siddall (Pierre-siddall) merged 9 commits into
MetOffice:mainfrom
ericaneininger:add_si3_fields

Conversation

@ericaneininger

@ericaneininger Erica Neininger (ericaneininger) commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

PR Summary

Add additional SI3 fields for processing by PostProc app: SBC_scalar and icemod_1d

Code Reviewer: Pierre Siddall (@Pierre-siddall)

The UKCM-LL configuration being used for CMIP7 production runs is currently using the SRS repo to build MOCI applications. That configuration uses some additional SI3 fieldnames which are not currently processed by the PostProc app.
This PR takes the SRS branch in use in that configuration and updates it for the Git repo.
postproc_2.5 branch (used in u-dv341): https://code.metoffice.gov.uk/trac/moci/log/main/branches/dev/ericaneininger/postproc_2.5_more_si3_fields

Addtionally, the file exclusions from chunking during compression, which are hard wired in the SRS branch, have been upgraded to read from the &nemo_processing namelist - hence the addition of rose metadata and an upgrade macro.

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 understanding 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. Required for any changes to
    • Coupled_Drivers application
    • Postprocessing application
    • Unittests
  • [NA] 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.)

I've tested this with rose-stem, and also a version of u-dv341 (UKCM configuration) which has been upgraded to use the Git repository.

trac.log

Test Suite Results - moci - TEST_si3/run1

Suite Information

Item Value
Suite Name TEST_si3/run1
Suite User erica.neininger
Workflow Start 2026-10-13T13:40:25
Groups Run postproc
Dependency Reference Main Like
moci ericaneininger/moci@add_si3_fields False
SimSys_Scripts MetOffice/SimSys_Scripts@main True

Task Information

✅ succeeded tasks - 99

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) '''NO AI use'

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

@github-actions github-actions Bot added the cla-modified The CLA has been modified as part of this PR - added by GA label Oct 15, 2026
@ericaneininger
Erica Neininger (ericaneininger) marked this pull request as draft October 15, 2026 11:23
@ericaneininger
Erica Neininger (ericaneininger) marked this pull request as ready for review October 15, 2026 15:43
@github-actions github-actions Bot removed the cla-modified The CLA has been modified as part of this PR - added by GA label Oct 15, 2026

@Pierre-siddall Pierre Siddall (Pierre-siddall) 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.

Thanks for this Erica Neininger (@ericaneininger), I think we may have had a chat about why .format is used in moci at some point but I was wondering if these were cases which could be replaced with an f-string to tidy up calls to data type objects?

if self.rebuild_suffix['REGEX']:
# Add processor number (if available) to field
patt = r'.*{}.*({})'.format(match[0], self.rebuild_suffix['REGEX'])
patt = r'.*{}.*({})'.format(in_field, self.rebuild_suffix['REGEX'])

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.

If f-string use can be used here and it doesn't have any impact on how the data is being processed it would be perferable to use it to avoid calls to .format.

@ericaneininger Erica Neininger (ericaneininger) Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

While this is technically true, the performance difference for a single f-string would be near non-existent, and it would not match the style of surrounding code. Therefore I wouldn't call changing just this one (or two) a "tidy up"!

Having said that, I'm happy to stipulate that any new modules should use f-strings, and perhaps - when resource is available - to re-factor the entire app. There are many other hangovers in the app for compatability with Python2.

.format() is prevalent in MOCI simply due to the age of the code and its origins in py2.

excl_fields = [f.replace('_', '-') for
f in self.naml.processing.chunking_exclude_fields]
if excl_fields:
return r'.*_({})\.nc'.format(('|').join(excl_fields))

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.

Would this also benefit from f-strings?

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.

Given the performance speedup would be negligable here, it makes sense from a pragmatic standpoint to allow these changes as proposed. However, future addtions should try to make use of f-strings to help move towards a modern standard of python.

@ericaneininger

Erica Neininger (ericaneininger) commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

I've replaced the deprecated environemnt variable CYLC_SUITE_SHARE_DIR in the debug-only method archive_integrity.log_archive, where it has started breaking a unittest in testing since the merging of MAIN to the branch, and since the latest upgrde to Cylc.

Ive also opened #76, to highlight that there are multiple other instances of deprecated CYLC envrionment variables across the MOCI codebase - fixing them here is well beyond the scope of this PR.

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.

Thanks Erica Neininger (@ericaneininger) , this has been retested and now passes. Merging into main now.

@Pierre-siddall
Pierre Siddall (Pierre-siddall) merged commit f49bf48 into MetOffice:main Oct 29, 2026
5 checks passed
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