update norms comparison for UM output as of UM#5034#47
Open
Erica Neininger (ericaneininger) wants to merge 1 commit intoMetOffice:mainfrom
Open
update norms comparison for UM output as of UM#5034#47Erica Neininger (ericaneininger) wants to merge 1 commit intoMetOffice:mainfrom
Erica Neininger (ericaneininger) wants to merge 1 commit intoMetOffice:mainfrom
Conversation
Collaborator
Sam Clarke-Green (t00sa)
left a comment
There was a problem hiding this comment.
Looks good. I've suggested a couple of adjustments, assuming that you are interested in capturing the initial error in both cases.
| r'\*.*Linear solve for Helmholtz problem.*\*' | ||
| ) | ||
| norms_regex = re.compile(r'\*\s+\d+\s+\d+\s+(\d+)\s+(\S+)\s+\*') | ||
| norms_regex = re.compile(r'\*\s+\d+\s+\d+\s+(\d+)(\s+\S+)?\s+(\S+)\s+\*') |
Collaborator
There was a problem hiding this comment.
Assuming that you want to capture the initial error in both cases, the match should always be on the first floating point value and the second one should be optional. If the second value isn't required, using a non-matching group removes the need for the change on L91.
Suggested change
| norms_regex = re.compile(r'\*\s+\d+\s+\d+\s+(\d+)(\s+\S+)?\s+(\S+)\s+\*') | |
| norms_regex = re.compile(r'\*\s+\d+\s+\d+\s+(\d+)\s+(\S+)\s+(?:\s+\S+)?\s+\*') |
| elif num_calls > 1: | ||
| try: | ||
| iterations, error = norms_regex.search(line).groups() | ||
| iterations, _, error = norms_regex.search(line).groups() |
Collaborator
There was a problem hiding this comment.
By skipping the capture of the unwanted value, this line can be left unchanged:
Suggested change
| iterations, _, error = norms_regex.search(line).groups() | |
| iterations, error = norms_regex.search(line).groups() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Code Reviewer: Sam Clarke-Green (@t00sa)
The format of the Helmholtz problem solver output changed to include both an initial and final error under UM#5024.
became
Until now the MOCI testing which utilised the norms comparison script has used an older version of the UM.
This change allows for both of these formats.
2 new unittests added and new format KGO file added.
Please note, these unit tests will be added to rose-stem under #46. Until then they are command line only.
Code Quality Checklist
(Some checks are automatically carried out via the CI pipeline)
readability of the code
Testing
acceptable (eg. kgo changes)
tests, unit tests, etc.)
Unit tests available: Utilities/verification_scripts/unittests/test_compare_norms.py
Security Considerations
Performance Impact
performance measurements have been conducted
AI Assistance and Attribution
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
confirmed that it builds correctly
Code Review