14 #include "eckit/mpi/Comm.h" 15 #include "oops/util/abor1_cpp.h" 16 #include "oops/util/Logger.h" 19 #include "ioda/ObsSpace.h" 25 <<
" elements." << std::endl;
29 : obsdb_(other.obsdb_), values_(obsdb_.
nobs()) {
31 <<
" elements." << std::endl;
44 for (
size_t jj = 0; jj <
values_.size() ; ++jj) {
53 const size_t nn =
values_.size();
54 ASSERT(rhs.
values_.size() == nn);
55 for (
size_t jj = 0; jj < nn ; ++jj) {
66 const size_t nn =
values_.size();
67 ASSERT(rhs.
values_.size() == nn);
68 for (
size_t jj = 0; jj < nn ; ++jj) {
79 const size_t nn =
values_.size();
80 ASSERT(rhs.
values_.size() == nn);
81 for (
size_t jj = 0; jj < nn ; ++jj) {
92 const size_t nn =
values_.size();
93 ASSERT(rhs.
values_.size() == nn);
94 for (
size_t jj = 0; jj < nn ; ++jj) {
105 for (
size_t jj = 0; jj <
values_.size() ; ++jj) {
111 const size_t nn =
values_.size();
112 ASSERT(rhs.
values_.size() == nn);
113 for (
size_t jj = 0; jj < nn ; ++jj) {
123 for (
size_t jj = 0; jj <
values_.size() ; ++jj) {
131 static std::mt19937 generator(1);
132 static std::normal_distribution<double> distribution(0.0, 1.0);
133 for (
size_t jj = 0; jj <
values_.size() ; ++jj) {
134 values_[jj] = distribution(generator);
139 const size_t nn =
values_.size();
140 ASSERT(other.
values_.size() == nn);
142 for (
size_t jj = 0; jj < nn ; ++jj) {
147 obsdb_.
comm().allReduceInPlace(zz, eckit::mpi::sum());
154 for (
size_t jj = 0; jj <
values_.size() ; ++jj) {
160 obsdb_.
comm().allReduceInPlace(zrms, eckit::mpi::sum());
162 if (
nobs > 0) zrms = sqrt(zrms / static_cast<double>(
nobs));
176 for (
size_t jj = 0; jj <
values_.size() ; ++jj) {
187 double zmax = std::numeric_limits<double>::lowest();
190 for (
size_t jj = 0; jj <
values_.size() ; ++jj) {
200 obsdb_.
comm().allReduceInPlace(zrms, eckit::mpi::sum());
202 if (
nobs > 0) zrms = sqrt(zrms / static_cast<double>(
nobs));
204 << zmin <<
", Max=" << zmax <<
", Average=" << zrms;
void axpy(const double &, const ObsVector &)
void read(const std::string &)
unsigned int nobs() const
ObsVector class to handle vectors in observation space for IODA.
std::vector< double > values_
Vector data.
const std::string & obsname() const
void save(const std::string &) const
subroutine, public copy(self, rhs)
const eckit::mpi::Comm & comm() const
ObsVector & operator+=(const ObsVector &)
Wrapper around ObsHelpQG, mostly to hide the factory.
void getObsVector(const std::string &, std::vector< double > &) const
ObsVector & operator=(const ObsVector &)
ObsVector & operator*=(const double &)
const ObsSpace & obsdb_
Associate ObsSpace object.
ObsVector & operator-=(const ObsVector &)
ObsVector(const ObsSpace &)
double dot_product_with(const ObsVector &) const
void putObsVector(const std::string &, const std::vector< double > &) const
void print(std::ostream &) const
ObsVector & operator/=(const ObsVector &)
const double missing_value