Go to the documentation of this file.
11 #ifndef OOPS_BASE_OBSERRORBASE_H_
12 #define OOPS_BASE_OBSERRORBASE_H_
18 #include <boost/noncopyable.hpp>
19 #include "eckit/config/Configuration.h"
22 #include "oops/util/abor1_cpp.h"
23 #include "oops/util/Logger.h"
24 #include "oops/util/Printable.h"
30 template<
typename OBS>
32 private boost::noncopyable {
58 template <
typename OBS>
62 static std::unique_ptr<ObsErrorBase<OBS> >
create(
const eckit::Configuration &,
69 static std::map < std::string, ObsErrorFactory<OBS> * > &
getMakers() {
70 static std::map < std::string, ObsErrorFactory<OBS> * > makers_;
77 template<
class OBS,
class T>
82 {
return new T(conf, obs); }
89 template <
typename OBS>
91 if (getMakers().find(name) != getMakers().end()) {
92 throw std::runtime_error(name +
" already registered in obs error factory.");
94 getMakers()[name] =
this;
99 template <
typename OBS>
100 std::unique_ptr<ObsErrorBase<OBS>>
102 Log::trace() <<
"ObsErrorBase<OBS>::create starting" << std::endl;
103 const std::string
id = conf.getString(
"covariance model");
104 typename std::map<std::string, ObsErrorFactory<OBS>*>::iterator
105 jerr = getMakers().find(
id);
106 if (jerr == getMakers().end()) {
107 throw std::runtime_error(
id +
" does not exist in obs error factory.");
109 std::unique_ptr<ObsErrorBase<OBS>> ptr(jerr->second->make(conf, obs));
110 Log::trace() <<
"ObsErrorBase<OBS>::create done" << std::endl;
118 #endif // OOPS_BASE_OBSERRORBASE_H_
The namespace for the main oops code.
virtual ~ObsErrorFactory()=default
ObsVector< OBS > ObsVector_
Base class for observation error covariance matrices.
ObsErrorMaker(const std::string &name)
virtual ~ObsErrorBase()=default
virtual double getRMSE() const =0
Get mean error for Jo table.
ObsSpace< OBS > ObsSpace_
virtual void inverseMultiply(ObsVector_ &dy) const =0
Multiply a Departure dy by .
static std::unique_ptr< ObsErrorBase< OBS > > create(const eckit::Configuration &, const ObsSpace_ &)
static std::map< std::string, ObsErrorFactory< OBS > * > & getMakers()
ObsErrorFactory(const std::string &)
ObsSpace< OBS > ObsSpace_
ObsSpace< OBS > ObsSpace_
virtual void randomize(ObsVector_ &dy) const =0
Generate random perturbation in dy.
virtual void multiply(ObsVector_ &dy) const =0
Multiply a Departure dy by $.
virtual ObsErrorBase< OBS > * make(const eckit::Configuration &conf, const ObsSpace_ &obs)
virtual ObsErrorBase< OBS > * make(const eckit::Configuration &, const ObsSpace_ &)=0
virtual const ObsVector_ & inverseVariance() const =0
Return inverseVariance.