11 #ifndef OOPS_BASE_OBSERVATIONS_H_
12 #define OOPS_BASE_OBSERVATIONS_H_
24 #include "oops/util/Logger.h"
25 #include "oops/util/Printable.h"
35 template <
typename OBS>
class Observations :
public util::Printable {
64 void save(
const std::string &)
const;
65 void read(
const std::string &);
76 void print(std::ostream &)
const;
81 std::vector<ObsVector_>
obs_;
86 template <
typename OBS>
88 const std::string & name): obsdb_(obsdb), obs_()
91 for (std::size_t jj = 0; jj < obsdb.
size(); ++jj) {
92 obs_.emplace_back(obsdb[jj], name,
true);
94 Log::trace() <<
"Observations created" << std::endl;
97 template <
typename OBS>
101 for (std::size_t jj = 0; jj < other.size(); ++jj) {
102 obs_.emplace_back(obsdb[jj], other[jj]);
104 Log::trace() <<
"Local observations created" << std::endl;
107 template <
typename OBS>
109 : obsdb_(other.obsdb_), obs_(other.obs_) {
113 template <
typename OBS>
115 : obsdb_(other.obsdb_), obs_(std::move(other.obs_)) {
118 template <
typename OBS>
121 ASSERT(&obsdb_ == &other.obsdb_);
126 template <
typename OBS>
129 ASSERT(&obsdb_ == &other.obsdb_);
130 obs_ = std::move(other.obs_);
134 template <
typename OBS>
137 for (std::size_t jj = 0; jj < obs_.size(); ++jj) {
139 diff[jj] -= other[jj];
144 template <
typename OBS>
146 for (std::size_t jj = 0; jj < obs_.size(); ++jj) {
152 template <
typename OBS>
154 for (std::size_t jj = 0; jj < obs_.size(); ++jj) {
159 template <
typename OBS>
161 for (std::size_t jj = 0; jj < obs_.size(); ++jj) {
166 template <
typename OBS>
168 for (std::size_t jj = 0; jj < obs_.size(); ++jj) {
173 template <
typename OBS>
175 for (std::size_t jj = 0; jj < obs_.size(); ++jj) {
180 template <
typename OBS>
182 for (std::size_t jj = 0; jj < obs_.size(); ++jj) {
188 template<
typename OBS>
191 for (
size_t jj = 0; jj < obs_.size(); ++jj) {
192 nobs += obs_[jj].nobs();
197 template <
typename OBS>
202 Log::trace() <<
"Observations perturbed" << std::endl;
205 template <
typename OBS>
207 for (std::size_t jj = 0; jj < obs_.size(); ++jj) os << obs_[jj] << std::endl;
212 #endif // OOPS_BASE_OBSERVATIONS_H_