8 #ifndef OOPS_BASE_OBSAUXCOVARIANCES_H_
9 #define OOPS_BASE_OBSAUXCOVARIANCES_H_
16 #include <boost/noncopyable.hpp>
18 #include "eckit/config/Configuration.h"
23 #include "oops/util/Logger.h"
24 #include "oops/util/Printable.h"
32 template <
typename OBS>
34 private boost::noncopyable {
41 static const std::string
classname() {
return "oops::ObsAuxCovariances";}
52 const eckit::LocalConfiguration &
config()
const {
return conf_;}
56 void print(std::ostream &)
const;
57 std::vector<std::unique_ptr<ObsAuxCovariance_> >
cov_;
59 const eckit::LocalConfiguration
conf_;
64 template<
typename OBS>
66 const eckit::Configuration & conf)
67 : cov_(0), odb_(odb), conf_(conf)
69 Log::trace() <<
"ObsAuxCovariances<OBS>::ObsAuxCovariances starting" << std::endl;
70 std::vector<eckit::LocalConfiguration> obsconf = conf.getSubConfigurations();
71 for (std::size_t jobs = 0; jobs < obsconf.size(); ++jobs) {
72 eckit::LocalConfiguration obsauxconf = obsconf[jobs].getSubConfiguration(
"obs bias");
74 obsauxparams.validateAndDeserialize(obsauxconf);
76 std::unique_ptr<ObsAuxCovariance_>(
new ObsAuxCovariance_(odb[jobs], obsauxparams)));
78 Log::trace() <<
"ObsAuxCovariances<OBS>::ObsAuxCovariances done" << std::endl;
83 template<
typename OBS>
85 Log::trace() <<
"ObsAuxCovariances<OBS>::~ObsAuxCovariances starting" << std::endl;
86 for (std::size_t jobs = 0; jobs < cov_.size(); ++jobs) {
89 Log::trace() <<
"ObsAuxCovariances<OBS>::~ObsAuxCovariances done" << std::endl;
94 template<
typename OBS>
96 const eckit::Configuration & innerConf) {
97 Log::trace() <<
"ObsAuxCovariances<OBS>::linearize starting" << std::endl;
98 ASSERT(cov_.size() == xx.
size());
99 for (std::size_t jobs = 0; jobs < xx.
size(); ++jobs) {
100 cov_[jobs]->linearize(xx[jobs], innerConf);
102 Log::trace() <<
"ObsAuxCovariances<OBS>::linearize done" << std::endl;
107 template<
typename OBS>
110 Log::trace() <<
"ObsAuxCovariances<OBS>::multiply starting" << std::endl;
111 ASSERT(dx1.
size() == dx2.
size() && cov_.size() == dx1.
size());
112 for (std::size_t jobs = 0; jobs < dx1.
size(); ++jobs) {
113 cov_[jobs]->multiply(dx1[jobs], dx2[jobs]);
115 Log::trace() <<
"ObsAuxCovariances<OBS>::multiply done" << std::endl;
120 template<
typename OBS>
123 Log::trace() <<
"ObsAuxCovariances<OBS>::inverseMultiply starting" << std::endl;
124 ASSERT(dx1.
size() == dx2.
size() && cov_.size() == dx1.
size());
125 for (std::size_t jobs = 0; jobs < dx1.
size(); ++jobs) {
126 cov_[jobs]->inverseMultiply(dx1[jobs], dx2[jobs]);
128 Log::trace() <<
"ObsAuxCovariances<OBS>::inverseMultiply done" << std::endl;
133 template<
typename OBS>
135 Log::trace() <<
"ObsAuxCovariances<OBS>::randomize starting" << std::endl;
136 ASSERT(cov_.size() == dx.
size());
137 for (std::size_t jobs = 0; jobs < dx.
size(); ++jobs) {
138 cov_[jobs]->randomize(dx[jobs]);
140 Log::trace() <<
"ObsAuxCovariances<OBS>::randomize done" << std::endl;
145 template<
typename OBS>
147 Log::trace() <<
"ObsAuxCovariances<OBS>::print starting" << std::endl;
148 for (std::size_t jobs = 0; jobs < cov_.size(); ++jobs) os << *cov_.at(jobs) <<
" ";
149 Log::trace() <<
"ObsAuxCovariances<OBS>::print done" << std::endl;
Holds a vector of ObsAuxControl.
std::size_t size() const
Access.
Auxiliary error covariance related to observations, templated on <OBS>
ObsAuxCovariance_::Parameters_ Parameters_
Holds a vector of ObsAuxCovariance.
void multiply(const ObsAuxIncrements_ &, ObsAuxIncrements_ &) const
const eckit::LocalConfiguration & config() const
void print(std::ostream &) const
void linearize(const ObsAuxControls_ &, const eckit::Configuration &)
Operators.
void randomize(ObsAuxIncrements_ &) const
const eckit::LocalConfiguration conf_
ObsAuxCovariances(const ObsSpaces_ &, const eckit::Configuration &)
std::vector< std::unique_ptr< ObsAuxCovariance_ > > cov_
ObsSpaces< OBS > ObsSpaces_
const ObsSpaces_ & obspaces() const
ObsAuxIncrements< OBS > ObsAuxIncrements_
ObsAuxControls< OBS > ObsAuxControls_
static const std::string classname()
void inverseMultiply(const ObsAuxIncrements_ &, ObsAuxIncrements_ &) const
ObsAuxCovariance< OBS > ObsAuxCovariance_
Holds a vector of ObsAuxIncrement.
std::size_t size() const
Access.
The namespace for the main oops code.