Fix uninitialised access of met variables during range checks#702
Merged
SeanBryan51 merged 2 commits intomainfrom Feb 27, 2026
Merged
Fix uninitialised access of met variables during range checks#702SeanBryan51 merged 2 commits intomainfrom
met variables during range checks#702SeanBryan51 merged 2 commits intomainfrom
Conversation
There are a few instances where range checks are performed before the variables `met%hod`, `met%doy`, and `met%year` are initialised in the `get_met_data` subroutine. When debug flags are enabled, floating point exceptions are produced when attempting to access these arrays. This change makes the `met` arguments optional for the cases when range checks are performed during the initialisation phase.
483882b to
3a40d30
Compare
met argument to range_abort optionalmet variables during range checks
ccarouge
approved these changes
Feb 27, 2026
Member
ccarouge
left a comment
There was a problem hiding this comment.
Look good. Just a small comment on mpimaster.
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.
There are a few instances where range checks are performed before the variables
met%hod,met%doy, andmet%yearare initialised in theget_met_datasubroutine. When debug flags are enabled, floating point exceptions are produced when attempting to access these arrays. This occurs for configurations whereMetType /= " "andcheck%ranges /= 0(i.e. range checks are enabled), and when a variable that is outside the range of its allowed values is detected. I hit this case when writing theAreavariable in #689. This change makes themetarguments optional when range checks are performed during the initialisation phase to avoid the uninitialised access ofmet%hod,met%doy, andmet%year.Type of change
Please delete options that are not relevant.
Testing
📚 Documentation preview 📚: https://cable--702.org.readthedocs.build/en/702/