11 #ifndef OOPS_GENERIC_PARAMETERSBUMP_H_ 12 #define OOPS_GENERIC_PARAMETERSBUMP_H_ 18 #include <boost/date_time/posix_time/posix_time.hpp> 19 #include <boost/scoped_ptr.hpp> 21 #include "eckit/config/Configuration.h" 30 #include "oops/util/DateTime.h" 31 #include "oops/util/Duration.h" 32 #include "oops/util/Logger.h" 43 template<
typename MODEL>
55 static const std::string
classname() {
return "oops::ParametersBUMP";}
63 const eckit::LocalConfiguration
conf_;
70 template<
typename MODEL>
72 : conf_(
conf), colocated_(1), keyBUMP_(0)
74 Log::trace() <<
"ParametersBUMP<MODEL>::ParametersBUMP construction starting" << std::endl;
75 util::Timer timer(
classname(),
"ParametersBUMP");
77 const eckit::Configuration * fconf = &
conf;
80 const eckit::LocalConfiguration resolConfig(
conf_,
"resolution");
84 const eckit::LocalConfiguration varConfig(
conf_,
"variables");
88 const util::DateTime
date(
conf_.getString(
"date"));
91 const eckit::LocalConfiguration backgroundConfig(
conf_,
"background");
102 const eckit::LocalConfiguration ensembleConfig(
conf_,
"ensemble");
104 ens_ptr->linearize(xx, xx, resol);
106 int ens1_ne = ens_ptr->size();
109 boost::ptr_vector<Increment_> bkgens;
111 if (
conf_.has(
"covariance")) {
113 const eckit::LocalConfiguration covarConfig(
conf_,
"covariance");
117 ens2_ne = covarConfig.getInt(
"pseudoens_size");
118 for (
int ii = 0; ii < ens2_ne; ++ii) {
121 bkgens.push_back(incr);
129 const double rk = sqrt((static_cast<double>(ens1_ne) - 1.0));
130 for (
int ie = 0;
ie < ens1_ne; ++
ie) {
131 Log::info() <<
"Copy ensemble member " <<
ie+1 <<
" / " 132 << ens1_ne <<
" to BUMP" << std::endl;
147 for (
int ie = 0;
ie < ens2_ne; ++
ie) {
148 Log::info() <<
"Copy pseudo ensemble member " <<
ie+1 <<
" / " 149 << ens2_ne <<
" to BUMP" << std::endl;
159 Log::trace() <<
"ParametersBUMP:ParametersBUMP constructed" << std::endl;
164 template<
typename MODEL>
166 Log::trace() <<
"ParametersBUMP<MODEL>::~ParametersBUMP destruction starting" << std::endl;
167 util::Timer timer(classname(),
"~ParametersBUMP");
169 Log::trace() <<
"ParametersBUMP:~ParametersBUMP destructed" << std::endl;
174 template<
typename MODEL>
176 Log::trace() <<
"ParametersBUMP::estimate starting" << std::endl;
177 util::Timer timer(classname(),
"estimate");
180 if (conf_.has(
"input")) {
182 const eckit::LocalConfiguration resolConfig(conf_,
"resolution");
186 const eckit::LocalConfiguration varConfig(conf_,
"variables");
190 const util::DateTime
date(conf_.getString(
"date"));
199 std::vector<eckit::LocalConfiguration> inputConfigs;
200 conf_.get(
"input", inputConfigs);
201 for (
const auto &
conf : inputConfigs) {
203 dx.field_to_ug(ug, colocated_);
204 std::string param =
conf.getString(
"parameter");
205 const int nstr = param.size();
206 const char *cstr = param.c_str();
215 std::ifstream infile(
"bump.test");
217 while (std::getline(infile, line))
Log::test() << line << std::endl;
220 Log::trace() <<
"ParametersBUMP:estimate done" << std::endl;
225 template<
typename MODEL>
227 Log::trace() <<
"ParametersBUMP::write starting" << std::endl;
228 util::Timer timer(classname(),
"write");
231 const eckit::LocalConfiguration resolConfig(conf_,
"resolution");
235 const eckit::LocalConfiguration varConfig(conf_,
"variables");
239 const util::DateTime
date(conf_.getString(
"date"));
247 dx.field_to_ug(ug, colocated_);
250 std::vector<eckit::LocalConfiguration> outputConfigs;
251 conf_.get(
"output", outputConfigs);
252 for (
const auto &
conf : outputConfigs) {
253 std::string param =
conf.getString(
"parameter");
254 const int nstr = param.size();
255 const char *cstr = param.c_str();
257 dx.field_from_ug(ug);
259 Log::test() <<
"Norm of " << param <<
": " << dx.norm() << std::endl;
261 Log::trace() <<
"ParametersBUMP::write done" << std::endl;
268 #endif // OOPS_GENERIC_PARAMETERSBUMP_H_ void ug_coord(UnstructuredGrid &, const int &) const
Unstructured grid.
void delete_oobump_f90(const int &)
void get_oobump_param_f90(const int &, const int &, const char *, const int &)
Increment< MODEL > Increment_
boost::shared_ptr< StateEnsemble< MODEL > > EnsemblePtr_
static EnsemblesCollection< MODEL > & getInstance()
Wrapper for model space error covariances.
Encapsulates the model state.
ErrorCovariance< MODEL > ErrorCovariance_
The namespace for the main oops code.
void create_oobump_f90(int &, const int &, const eckit::Configuration *const *, const int &, const int &, const int &, const int &)
EnsemblesCollection< MODEL > EnsemblesCollection_
void field_to_ug(UnstructuredGrid &, const int &) const
static const std::string classname()
subroutine, public info(self)
void set_oobump_param_f90(const int &, const int &, const char *, const int &)
Geometry< MODEL > Geometry_
const eckit::LocalConfiguration conf_
Increment Class: Difference between two states.
ParametersBUMP(const eckit::Configuration &)
StateEnsemble< MODEL > Ensemble_
int readPseudoEnsMember(2)
void run_oobump_drivers_f90(const int &)
void add_oobump_member_f90(const int &, const int &, const int &, const int &)
void randomize(Increment_ &) const override
const util::DateTime validTime() const
Time.