fix: end_ensemble_manager check allocated variables are allocated bef… - #1186
Merged
Merged
Conversation
mjs2369
approved these changes
Sep 3, 2026
mjs2369
left a comment
Collaborator
There was a problem hiding this comment.
Clean fix, I agree this is the better route over a check on num_obs_in_set
…ore deallocating fixes #1174
hkershaw-brown
force-pushed
the
pmo-dealloc
branch
from
September 10, 2026 17:56
d6bf0db to
541f483
Compare
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.
Description:
This pull request adds a check in end_ensemble_manager to only call deallocate on arrays that have been allocated.
The allocatable variables in the type are:
integer, allocatable :: my_copies(:)
integer(i8), allocatable :: my_vars(:)
real(r8), allocatable :: copies(:, :)
real(r8), allocatable :: vars(:, :)
type(time_type), allocatable :: time(:)
integer, allocatable :: task_to_pe_list(:),
pe_to_task_list(:)
Fixes issue
fixes #1174
Note 1174 could be fixed by checking for num_obs_in_set = 0 and if so not ending fwd_op and qc ensemble handles, but I think the more general solution of checking if the arrays are allocated before deallocating in end_ensemble_manager. Because end_ensemble_manager is a cleanup routine so maybe you are bailing early, failing, or you have not realized perfect_model_obs can bail early - I don't think enforcing (by runtime error) a matching init/end for ensemble_manager is that helpful.
Types of changes
Documentation changes needed?
Tests
Please describe any tests you ran to verify your changes.
Checklist for merging
Checklist for release
Testing Datasets