11 #ifndef OOPS_BASE_OBSERRORS_H_
12 #define OOPS_BASE_OBSERRORS_H_
18 #include <boost/noncopyable.hpp>
23 #include "oops/util/ConfigFunctions.h"
24 #include "oops/util/Logger.h"
25 #include "oops/util/parameters/Parameters.h"
26 #include "oops/util/Printable.h"
32 template <
typename OBS>
34 private boost::noncopyable {
41 static const std::string
classname() {
return "oops::ObsErrors";}
60 void save(
const std::string &)
const;
66 void print(std::ostream &)
const override;
67 std::vector<ObsError_>
err_;
73 template <
typename OBS>
76 ASSERT(params.empty() || params.size() == os.
size());
80 for (
size_t jj = 0; jj < os.
size(); ++jj) {
81 const Parameters_ & param = params.empty() ? defaultParam : params[jj];
88 template <
typename OBS>
93 validateAndDeserialize<
Parameters_>(
util::vectoriseAndFilter(config,
"obs error")), os)
98 template <
typename OBS>
100 for (
size_t jj = 0; jj < err_.size(); ++jj) {
101 err_[jj].multiply(dy[jj]);
107 template <
typename OBS>
109 for (
size_t jj = 0; jj < err_.size(); ++jj) {
110 err_[jj].inverseMultiply(dy[jj]);
116 template <
typename OBS>
118 for (
size_t jj = 0; jj < err_.size(); ++jj) {
119 err_[jj].randomize(dy[jj]);
125 template <
typename OBS>
127 for (
const auto & err : err_) {
134 template <
typename OBS>
137 for (
size_t jj = 0; jj < err_.size(); ++jj) {
138 invvar[jj] = err_[jj].inverseVariance();
145 template<
typename OBS>
147 for (
size_t jj = 0; jj < err_.size(); ++jj) os << err_[jj] << std::endl;
Difference between two observation vectors.
Observation error covariance matrix of observations from a single ObsSpace.
Contains a polymorphic parameter holding an instance of a subclass of ObsErrorParametersBase.
PolymorphicParameter< ObsErrorParametersBase, ObsErrorFactory< OBS > > obsErrorParameters
Container for ObsErrors for all observation types that are used in DA.
ObsError< OBS > ObsError_
ObsErrorParametersWrapper< OBS > Parameters_
void save(const std::string &) const
Save obs errors.
void inverseMultiply(Departures_ &) const
Multiply a Departure by .
void multiply(Departures_ &) const
Multiply a Departure by .
ObsSpaces< OBS > ObsSpaces_
size_t size() const
Accessor and size.
const ObsError_ & operator[](const size_t ii) const
Departures< OBS > Departures_
Departures_ inverseVariance() const
returns inverse of observation error variance
void randomize(Departures_ &) const
Generate random perturbation.
void print(std::ostream &) const override
static const std::string classname()
std::vector< ObsError_ > err_
ObsErrors(const std::vector< Parameters_ > &, const ObsSpaces_ &)
ObsError_ & operator[](const size_t ii)
std::size_t size() const
Access.
The namespace for the main oops code.