Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+Add and use the new interface field_checksum #841

Merged
merged 3 commits into from
Feb 24, 2025

Conversation

Hallberg-NOAA
Copy link
Member

This PR consists of three commits that first add the new publicly visible interface field_checksum() to return the checksums that are used to verify that the arrays that written to or read from files are correct, and then uses this new interface in get_depth_list_checksum(), save_restart() and restore state().

The new field_checksum() interface includes the options to handle both the unscaling and rotation of the arrays. The 5 internal rotated_field_chksum_real_...() functions were renamed to field_checksum_real_...() to reflect their slightly broadened purpose and now have new optional unscale arguments. The previous rotated_field_chksum() interface has been retained because it is still being used in SIS2, but this may change in the future.

The refactoring of get_depth_list_checksum() allows it to work in scaled units for dimensional consistency verification. The changes in save_restart() and restore_state() eliminate a total of 10 instances of array-syntax math which are unnecessary in most cases because the conversion factor is 1.

All answers and output are bitwise identical, but there is a new publicly visible interface, field_checksum(). The specific commits in this PR include:

  • 18daedcc7 Use field_checksum in save_restart & restore_state
  • 70987d86c Refactor get_depth_list_checksum
  • af6a5b044 +Add the new interface field_checksum

  Added the new publicly visible interface field_checksum to return the checksum
that is used to verify the arrays that are written to or read from files, while
handling both the unscaling and rotation of the arrays.  The 5 internal
rotated_field_chksum_real_... functions were renamed to field_checksum_real_...
to reflect their slightly broadened purpose and now have new optional unscale
arguments.  The previous rotated_field_chksum interface has been retained
because it is still being used in SIS2, but this may change in the future.  All
answers are bitwise identical, but there is a new public function interface and
a new optional argument to a preexisting one.
  Use field_checksum in get_depth_list_checksum to relocate two rescaling
factors into unscale arguments and work in scaled internal variables in that
routine.  All answers are bitwise identical.
  Use field_checksum and its unscale argument in save_restart and restore_state
to avoid 10 instances of array-syntax math which are unnecessary in most cases
because the conversion factor is 1.  All answers are bitwise identical.
@Hallberg-NOAA Hallberg-NOAA added the enhancement New feature or request label Feb 23, 2025
Copy link
Member

@marshallward marshallward left a comment

Choose a reason for hiding this comment

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

Renaming rotated_field_chksum to the more general field_checksum looks good to me. And fewer scaling parameters in the equations is always a win. I approve this.

There may be some confusion now that the MOM6 field_checksum alongside the framework's field_chksum. It might be helpful to rename field_chksum to fms_field_chksum in files where both are present.

@Hallberg-NOAA
Copy link
Member Author

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/26494.

@Hallberg-NOAA Hallberg-NOAA merged commit 86ed81f into NOAA-GFDL:dev/gfdl Feb 24, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants