Skip to content

fix: end_ensemble_manager check allocated variables are allocated bef… - #1186

Merged
hkershaw-brown merged 1 commit into
mainfrom
pmo-dealloc
Sep 10, 2026
Merged

hkershaw-brown merged 1 commit into
mainfrom
pmo-dealloc

Conversation

@hkershaw-brown

@hkershaw-brown hkershaw-brown commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

Please describe any tests you ran to verify your changes.

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

@mjs2369
mjs2369 requested review from mjs2369 and removed request for mjs2369 September 3, 2026 19:50

@mjs2369 mjs2369 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean fix, I agree this is the better route over a check on num_obs_in_set

@hkershaw-brown hkershaw-brown added the release! bundle with next release label Sep 9, 2026
@hkershaw-brown
hkershaw-brown merged commit 9784110 into main Sep 10, 2026
13 checks passed
@hkershaw-brown
hkershaw-brown deleted the pmo-dealloc branch September 10, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release! bundle with next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pmo runtime error: Attempt to DEALLOCATE unallocated 'ens_handle' when the observation sequence has 0 obs

2 participants