8 #ifndef OOPS_RUNS_CONVERTINCREMENT_H_
9 #define OOPS_RUNS_CONVERTINCREMENT_H_
15 #include "eckit/config/LocalConfiguration.h"
23 #include "oops/util/DateTime.h"
24 #include "oops/util/Duration.h"
25 #include "oops/util/Logger.h"
40 instantiateVariableChangeFactory<MODEL>();
45 int execute(
const eckit::Configuration & fullConfig)
const {
47 const eckit::LocalConfiguration inputResolConfig(fullConfig,
"input geometry");
50 const eckit::LocalConfiguration outputResolConfig(fullConfig,
"output geometry");
54 std::vector<bool> inverse;
55 std::vector<bool> adjoint;
57 std::vector<eckit::LocalConfiguration> chvarconfs;
58 fullConfig.get(
"linear variable changes", chvarconfs);
59 for (
size_t cv = 0; cv < chvarconfs.size(); ++cv) {
60 inverse.push_back(chvarconfs[cv].getBool(
"do inverse",
false));
61 adjoint.push_back(chvarconfs[cv].getBool(
"do adjoint",
false));
65 std::vector<eckit::LocalConfiguration> incrementsConf;
66 fullConfig.get(
"increments", incrementsConf);
67 int nincrements = incrementsConf.size();
70 for (
int jm = 0; jm < nincrements; ++jm) {
72 Log::info() <<
"Converting increment " << jm+1 <<
" of " << nincrements << std::endl;
75 const util::DateTime incdatetime(incrementsConf[jm].getString(
"date"));
78 const Variables incvars(incrementsConf[jm],
"input variables");
81 const eckit::LocalConfiguration inputConfig(incrementsConf[jm],
"input");
83 dxi.
read(inputConfig);
84 Log::test() <<
"Input increment: " << dxi << std::endl;
87 std::unique_ptr<Increment_> dx(
new Increment_(resol2, dxi));
90 std::unique_ptr<State_> xtraj;
93 for (
size_t cv = 0; cv < chvarconfs.size(); ++cv) {
96 const eckit::LocalConfiguration trajConfig(incrementsConf[jm],
"trajectory");
97 xtraj.reset(
new State_(resol1, trajConfig));
98 ASSERT(xtraj->validTime() == dx->validTime());
99 Log::test() <<
"Trajectory state: " << *xtraj << std::endl;
103 std::unique_ptr<LinearVariableChange_> lvc;
107 Log::info() <<
"Variable transform " << cv+1 <<
" of " << chvarconfs.size() <<
": "
108 << *lvc << std::endl;
113 Log::test() <<
"Increment after variable transform: " << *dx << std::endl;
117 const eckit::LocalConfiguration outputConfig(incrementsConf[jm],
"output");
118 dx->write(outputConfig);
120 Log::test() <<
"Output increment: " << *dx << std::endl;
127 return "oops::ConvertIncrement<" + MODEL::name() +
">";
const eckit::mpi::Comm & getComm() const
Geometry< MODEL > Geometry_
LinearVariableChangeFactory< MODEL > LinearVariableChangeFactory_
std::string appname() const
Increment< MODEL > Increment_
virtual ~ConvertIncrement()
LinearVariableChangeBase< MODEL > LinearVariableChange_
ConvertIncrement(const eckit::mpi::Comm &comm=oops::mpi::world())
int execute(const eckit::Configuration &fullConfig) const
Geometry class used in oops; subclass of interface class interface::Geometry.
Increment class used in oops.
LinearVariableChange factory.
static LinearVariableChangeBase< MODEL > * create(const State_ &, const State_ &, const Geometry_ &, const LinearVariableChangeParametersBase ¶meters)
Create and return a new linear variable change.
State class used in oops; subclass of interface class interface::State.
void read(const eckit::Configuration &)
Read this Increment from file.
const eckit::mpi::Comm & world()
Default communicator with all MPI tasks (ie MPI_COMM_WORLD)
The namespace for the main oops code.