8 #ifndef OOPS_RUNS_LOCALENSEMBLEDA_H_
9 #define OOPS_RUNS_LOCALENSEMBLEDA_H_
14 #include "eckit/config/LocalConfiguration.h"
29 #include "oops/util/DateTime.h"
30 #include "oops/util/Duration.h"
31 #include "oops/util/Logger.h"
52 instantiateLocalEnsembleSolverFactory<MODEL, OBS>();
53 instantiateObsErrorFactory<OBS>();
54 instantiateObsFilterFactory<OBS>();
63 int execute(
const eckit::Configuration & fullConfig)
const {
65 const util::DateTime winbgn(fullConfig.getString(
"window begin"));
66 const util::Duration winlen(fullConfig.getString(
"window length"));
67 const util::DateTime winend(winbgn + winlen);
68 const util::DateTime winhalf = winbgn + winlen/2;
69 Log::info() <<
"Observation window from " << winbgn <<
" to " << winend << std::endl;
72 const eckit::LocalConfiguration geometryConfig(fullConfig,
"geometry");
76 ObsSpaces_ obsdb(fullConfig, this->
getComm(), winbgn, winend);
80 const eckit::LocalConfiguration bgConfig(fullConfig,
"background");
84 const size_t nens = ens_xx.
size();
88 std::unique_ptr<LocalSolver_> solver =
90 const eckit::LocalConfiguration driverConfig(fullConfig,
"driver");
93 for (
size_t jj = 0; jj < nens; ++jj) {
96 Log::test() <<
"Initial state for member " << jj+1 <<
":" << ens_xx[jj] << std::endl;
100 bool readFromDisk = driverConfig.getBool(
"read HX from disk",
false);
101 Observations_ yb_mean = solver->computeHofX(ens_xx, 0, readFromDisk);
102 Log::test() <<
"H(x) ensemble background mean: " << std::endl << yb_mean << std::endl;
106 Log::test() <<
"background y - H(x): " << std::endl << ombg << std::endl;
109 bool observerOnly = driverConfig.getBool(
"run as observer only",
false);
110 if (observerOnly) {
return 0;}
114 Log::test() <<
"Background mean :" << bkg_mean << std::endl;
124 Log::info() <<
"Beginning core local solver..." << std::endl;
126 solver->measurementUpdate(bkg_pert, i, ana_pert);
128 Log::info() <<
"Local solver completed." << std::endl;
131 for (
size_t jj = 0; jj < nens; ++jj) {
132 ens_xx[jj] = bkg_mean;
133 ens_xx[jj] += ana_pert[jj];
140 Log::info() <<
"Analysis mean :" << ana_mean << std::endl;
141 eckit::LocalConfiguration outConfig(fullConfig,
"output");
142 outConfig.set(
"member", 0);
143 ana_mean.
write(outConfig);
147 for (
size_t jj=0; jj < nens; ++jj) {
149 eckit::LocalConfiguration outConfig(fullConfig,
"output");
150 outConfig.set(
"member", mymember);
151 ens_xx[jj].write(outConfig);
159 bool do_posterior_observer = driverConfig.getBool(
"do posterior observer",
true);
160 if (do_posterior_observer) {
161 Observations_ ya_mean = solver->computeHofX(ens_xx, 1,
false);
162 Log::test() <<
"H(x) ensemble analysis mean: " << std::endl << ya_mean << std::endl;
167 Log::test() <<
"analysis y - H(x): " << std::endl << oman << std::endl;
170 Log::test() <<
"ombg RMS: " << ombg.
rms() << std::endl
171 <<
"oman RMS: " << oman.
rms() << std::endl;
181 return "oops::LocalEnsembleDA<" + MODEL::name() +
", " + OBS::name() +
">";
188 #endif // OOPS_RUNS_LOCALENSEMBLEDA_H_