Skip to content

Conversation

@Hallberg-NOAA
Copy link
Member

This set of two commits first adds the new functions ints_to_string() and trim_trailing_commas() to MOM_string_functions, based on code that previously been in MOM_diag_mediator, and then in a second commit calls these functions from appropriate points in MOM_diag_mediator and eliminates the redundant code. All answers and output are bitwise identical, apart from three new tests reported on by string_functions_unit_tests().

  Copied the function i2s from MOM_diag_mediator into the function
ints_to_string in MOM_string_functions, and moved the code removing trailing
commas from two places in MOM_diag_mediator into the new function
trim_trailing_commas in MOM_string_functions.  Because of the duplication of
code between MOM6, SIS2 and the MOM6 ice shelf code, these functions would need
to be replicated 3 or 6 times without these changes.  Also added unit tests of
both new functions to string_functions_unit_tests.  All answers are bitwise
identical but there are two new public functions in MOM_string_functions.
  Call trim_trailing_commas from register_diag_field and register_static_field
and ints_to_string from trim_trailing_commas and eliminated the now redundant
routine i2s.  All code functions exactly as before but there is less duplicative
code.
@Hallberg-NOAA Hallberg-NOAA added the refactor Code cleanup with no changes in functionality or results label Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code cleanup with no changes in functionality or results

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant