Skip to content

Ensemble postproc: Allow to not have zero-out variables in the list of increment variables#1244

Merged
shlyaeva merged 3 commits into
developfrom
feature/ensrecenter_fix
May 27, 2026
Merged

Ensemble postproc: Allow to not have zero-out variables in the list of increment variables#1244
shlyaeva merged 3 commits into
developfrom
feature/ensrecenter_fix

Conversation

@shlyaeva
Copy link
Copy Markdown
Collaborator

Description

Allows to not specify zero-out variables in the list of increment variables in the ensemble postprocessing app (they don't need to come from backgrounds or analyses since they are zeroed out anyway!)

This would allow us to run recentering app with LETKF, while recentering analyses that don't have currents around the 3DVar analysis that doesn't have currents. (mom6 IAU requires currents in the increments files).

Manual Testing Instructions (optional)

Specify the currents variables only in set increment variables to zero yaml section in the ensemble postprocessing app in gdas.

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have run the unit tests before creating the PR

Copy link
Copy Markdown
Contributor

@guillaumevernieres guillaumevernieres left a comment

Choose a reason for hiding this comment

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

👍

@shlyaeva
Copy link
Copy Markdown
Collaborator Author

I've pushed a minor update to State::operator+= that allows the increment that's added to the state to have more variables than in the state (those are ignored in this case). This is to handle adding the increment with extra (zeroed-out variables) to the background state.

@shlyaeva shlyaeva requested a review from Dooruk May 26, 2026 18:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the SOCA ensemble analysis postprocessing workflow to support “zero-out” increment variables that are not included in the configured increment variables list, enabling use cases like LETKF recentering when the deterministic analysis lacks certain variables (e.g., currents) that MOM6 IAU still requires in the increment output.

Changes:

  • Allow set increment variables to zero to include variables not present in increment variables by expanding each member increment’s allocated fields before zeroing.
  • Make soca::State::operator+= skip increment fields that do not exist in the target State (instead of failing), enabling increments to carry extra fields.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/soca/State/State.cc Skip adding increment fields that aren’t present in the State, with a log message.
src/mains/AnalysisPostproc.h If zero-out vars aren’t in the increment variable set, allocate them in each increment before calling zero(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/soca/State/State.cc
Comment on lines +251 to +254
if (!fieldSet_.has(src.name())) {
oops::Log::warning() << "State does not have variable " << src.name()
<< " from Increment, skipping." << std::endl;
continue;
Comment on lines 321 to +328
if (!(socaZeroIncrVar <= incs.variables())) {
oops::Log::error() << "Variables to zero must be a subset of increment variables"
<< std::endl;
throw eckit::UserError("Invalid variables to zero", Here());
// Add variables that have to be set to zero to the increment variables,
// so that the increment can be updated
oops::Variables newvars = incs.variables();
newvars += socaZeroIncrVar;
for (size_t jj = 0; jj < incs.size(); ++jj) {
incs[jj].increment().updateFields(newvars);
}
@shlyaeva shlyaeva merged commit cf90406 into develop May 27, 2026
4 checks passed
@shlyaeva shlyaeva deleted the feature/ensrecenter_fix branch May 27, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants