11 #ifndef SABER_OOPS_ESTIMATEPARAMS_H_
12 #define SABER_OOPS_ESTIMATEPARAMS_H_
20 #include "eckit/config/Configuration.h"
21 #include "oops/base/IncrementEnsemble.h"
22 #include "oops/interface/Increment.h"
23 #include "oops/interface/State.h"
24 #include "oops/mpi/mpi.h"
25 #include "oops/runs/Application.h"
26 #include "oops/util/Logger.h"
47 typedef std::shared_ptr<oops::IncrementEnsemble<MODEL>>
EnsemblePtr_;
51 static const std::string
classname() {
return "saber::EstimateParams";}
52 explicit EstimateParams(
const eckit::mpi::Comm & comm = oops::mpi::world()) : Application(comm) {
53 instantiateCovarFactory<MODEL>();
58 int execute(
const eckit::Configuration & fullConfig)
const {
62 const eckit::LocalConfiguration resolConfig(fullConfig,
"geometry");
63 const Geometry_ resol(resolConfig, this->getComm());
66 const oops::Variables vars(fullConfig,
"input variables");
69 const eckit::LocalConfiguration backgroundConfig(fullConfig,
"background");
70 State_ xx(resol, backgroundConfig);
73 const util::DateTime time = xx.validTime();
77 if (fullConfig.has(
"ensemble")) {
78 const eckit::LocalConfiguration ensembleConfig(fullConfig,
"ensemble");
79 ens1.reset(
new Ensemble_(ensembleConfig, xx, xx, resol, vars));
80 for (
size_t ie = 0; ie < ens1->size(); ++ie) {
81 (*ens1)[ie].toAtlas();
87 if (fullConfig.has(
"covariance")) {
88 const eckit::LocalConfiguration covarConfig(fullConfig,
"covariance");
89 int ens2_ne = covarConfig.getInt(
"pseudoens_size");
90 ens2.reset(
new Ensemble_(resol, vars, time, ens2_ne));
92 std::unique_ptr<oops::ModelSpaceCovarianceBase<MODEL>>
93 cov(oops::CovarianceFactory<MODEL>::create(covarConfig, resol, vars, xx, xx));
94 for (
int ie = 0; ie < ens2_ne; ++ie) {
95 oops::Log::info() <<
"Generate pseudo ensemble member " << ie+1 <<
" / "
96 << ens2_ne << std::endl;
100 cov->randomize(incr);
102 (*ens2)[ie].toAtlas();
117 return "saber::EstimateParams<" + MODEL::name() +
">";
123 #endif // SABER_OOPS_ESTIMATEPARAMS_H_