Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the unbalanced ssh std dev to B #616

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions utils/soca/gdas_ens_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,24 @@ namespace gdasapp {
// Zero out specified fields (again, steric heigh is now in ssh from the previous step)
incr = postProcIncr.setToZero(incr);

// Filter ensemble member and recompute ssh, recentering around the cycle's trajectory
// Filter ensemble member and recompute steric ssh, recentering around
// the cycle's trajectory
if ( fullConfig.has("linear variable change") ) {
eckit::LocalConfiguration lvcConfig(fullConfig, "linear variable change");
postProcIncr.applyLinVarChange(incr, lvcConfig, cycleTraj);
}

// Add the unbalanced ssh to the recentered perturbation
// this assumes ssh_u is independent of the trajectory
oops::Log::info() << "&&&&& before adding ssh_u " << incr << std::endl;
atlas::FieldSet incrFs;
incr.toFieldSet(incrFs);
atlas::FieldSet sshNonStericFs;
sshNonSteric[i].toFieldSet(sshNonStericFs);
util::addFieldSets(incrFs, sshNonStericFs);
incr.fromFieldSet(incrFs);
oops::Log::info() << "&&&&& after adding ssh_u " << incr << std::endl;

// Save final perturbation, used in the offline EnVAR
result = postProcIncr.save(incr, i+1);

Expand Down Expand Up @@ -212,21 +224,32 @@ namespace gdasapp {

// Compute ensemble moments for non-steric ssh
sshMean.zero();
sshStd.zero();
soca::Increment sshNonStericVariance(geom, socaSshVar, postProcIncr.dt_);
gdasapp_ens_utils::ensMoments(sshNonSteric, sshMean, sshStd, sshNonStericVariance);
soca::Increment sshNonStericStd(geom, socaSshVar, postProcIncr.dt_);
sshNonStericStd.zero();
gdasapp_ens_utils::ensMoments(sshNonSteric, sshMean, sshNonStericStd, sshNonStericVariance);
oops::Log::info() << "mean non-steric ssh: " << sshMean << std::endl;
oops::Log::info() << "std non-steric ssh: " << sshStd << std::endl;
oops::Log::info() << "std non-steric ssh: " << sshNonStericStd << std::endl;
eckit::LocalConfiguration nonStericSshOutputConfig(fullConfig, "ssh output.unbalanced");
sshStd.write(nonStericSshOutputConfig);

// Compute filtered ensemble moments, used in the static B
// Compute filtered ensemble moments
ensMean.zero();
ensStd.zero();
ensVariance.zero();
gdasapp_ens_utils::ensMoments(ensMembers, ensMean, ensStd, ensVariance);
oops::Log::info() << "filtered mean: " << ensMean << std::endl;
oops::Log::info() << "filtered std: " << ensStd << std::endl;

// Prepare D (diag of the static B): replace sigma ssh with sigma ssh_u
ensStd = postProcIncr.setToZero(ensStd); // Set ssh (and other specified fields to zero)
atlas::FieldSet ensStdFs;
ensStd.toFieldSet(ensStdFs);
atlas::FieldSet sshNonStericStdFs;
sshNonStericStd.toFieldSet(sshNonStericStdFs);
util::addFieldSets(ensStdFs, sshNonStericStdFs);
ensStd.fromFieldSet(ensStdFs);
oops::Log::info() << "std with ssh_u: " << ensStd << std::endl;
eckit::LocalConfiguration bkgErrOutputConfig(fullConfig, "background error output");
ensStd.write(bkgErrOutputConfig);

Expand Down
Loading