OOPS
GomQG.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #include "model/GomQG.h"
12 
13 #include <iomanip>
14 
15 #include "eckit/config/Configuration.h"
16 #include "model/LocationsQG.h"
17 #include "model/ObsSpaceQG.h"
18 #include "model/QgFortran.h"
19 #include "oops/base/Variables.h"
20 #include "oops/util/Logger.h"
21 
22 namespace qg {
23 
24 // -----------------------------------------------------------------------------
25 GomQG::GomQG(const LocationsQG & locs, const oops::Variables & var) {
26  // gom_setup just creates and allocates the GeoVaLs object without filling
27  // in values
28  qg_gom_setup_f90(keyGom_, locs, var);
29 }
30 // -----------------------------------------------------------------------------
31 /*! QG GeoVaLs Constructor with Config */
32 
33  GomQG::GomQG(const eckit::Configuration & config,
34  const ObsSpaceQG & ospace, const oops::Variables &)
35 {
38 }
39 // -----------------------------------------------------------------------------
40 // Copy constructor
41 GomQG::GomQG(const GomQG & other) {
44 }
45 // -----------------------------------------------------------------------------
48 }
49 // -----------------------------------------------------------------------------
50 double GomQG::rms() const {
51  double zz;
53  return zz;
54 }
55 // -----------------------------------------------------------------------------
56 double GomQG::normalizedrms(const GomQG & rhs) const {
57  GomQG temp_GomQG(*this);
58  qg_gom_divide_f90(temp_GomQG.keyGom_, rhs.keyGom_);
59  return temp_GomQG.rms();
60 }
61 // -----------------------------------------------------------------------------
62 void GomQG::zero() {
64 }
65 // -----------------------------------------------------------------------------
66 void GomQG::random() {
68 }
69 // -----------------------------------------------------------------------------
70 GomQG & GomQG::operator=(const GomQG & rhs) {
71  const int keyGomRhs = rhs.keyGom_;
72  qg_gom_copy_f90(keyGom_, keyGomRhs);
73  return *this;
74 }
75 // -----------------------------------------------------------------------------
76 GomQG & GomQG::operator*=(const double & zz) {
78  return *this;
79 }
80 // -----------------------------------------------------------------------------
81 GomQG & GomQG::operator+=(const GomQG & other) {
83  return *this;
84 }
85 // -----------------------------------------------------------------------------
86 GomQG & GomQG::operator-=(const GomQG & other) {
88  return *this;
89 }
90 // -----------------------------------------------------------------------------
91 GomQG & GomQG::operator*=(const GomQG & other) {
93  return *this;
94 }
95 // -----------------------------------------------------------------------------
96 double GomQG::dot_product_with(const GomQG & other) const {
97  double zz;
99  return zz;
100 }
101 // -----------------------------------------------------------------------------
102 void GomQG::read(const eckit::Configuration & config) {
103  qg_gom_read_file_f90(keyGom_, config);
104 }
105 // -----------------------------------------------------------------------------
106 void GomQG::write(const eckit::Configuration & config) const {
108 }
109 // -----------------------------------------------------------------------------
110 void GomQG::print(std::ostream & os) const {
111  int nn;
112  double scaling, zmin, zmax, zrms;
113  qg_gom_stats_f90(keyGom_, nn, scaling, zmin, zmax, zrms);
114  std::ios_base::fmtflags f(os.flags());
115  os << " nobs= " << nn
116  << ", Scaling=" << std::setprecision(4) << std::setw(7) << scaling
117  << ", Min=" << std::fixed << std::setprecision(4) << std::setw(12) << zmin
118  << ", Max=" << std::fixed << std::setprecision(4) << std::setw(12) << zmax
119  << ", RMS=" << std::fixed << std::setprecision(4) << std::setw(12) << zrms;
120  os.flags(f);
121 
122  // If the min value across all variables is positive, then this may be an
123  // error measurement. If so, print the location and variable where the
124  // maximum occurs to the debug stream, for use in debugging
125 
126  if (zmin >= 0.0) {
127  double mxval;
128  int iloc, ivar;
129 
130  qg_gom_maxloc_f90(keyGom_, mxval, iloc, ivar);
131 
132  oops::Log::debug() << "GomQG: Maximum Value = " << std::setprecision(4)
133  << mxval << " at location = " << iloc
134  << " and variable = " << ivar << std::endl;
135  }
136 }
137 // -----------------------------------------------------------------------------
138 } // namespace qg
qg::qg_gom_write_file_f90
void qg_gom_write_file_f90(const F90gom &, const eckit::Configuration &)
ObsSpaceQG.h
qg
The namespace for the qg model.
Definition: qg/model/AnalyticInit.cc:13
QgFortran.h
qg::qg_gom_setup_f90
void qg_gom_setup_f90(F90gom &, const LocationsQG &, const oops::Variables &)
qg::GomQG::GomQG
GomQG()
Definition: GomQG.h:42
qg::GomQG::random
void random()
Definition: GomQG.cc:66
qg::GomQG::keyGom_
F90gom keyGom_
Definition: GomQG.h:64
qg::GomQG::read
void read(const eckit::Configuration &)
Definition: GomQG.cc:102
qg::GomQG::normalizedrms
double normalizedrms(const GomQG &) const
Definition: GomQG.cc:56
qg::ObsSpaceQG
ObsSpace for QG model.
Definition: ObsSpaceQG.h:44
qg::qg_gom_diff_f90
void qg_gom_diff_f90(const F90gom &, const F90gom &)
qg::qg_gom_delete_f90
void qg_gom_delete_f90(F90gom &)
GomQG.h
qg::LocationsQG
LocationsQG class to handle locations for QG model.
Definition: LocationsQG.h:36
LocationsQG.h
qg::qg_gom_maxloc_f90
void qg_gom_maxloc_f90(const F90gom &, double &, int &, int &)
qg::GomQG::operator=
GomQG & operator=(const GomQG &)
Definition: GomQG.cc:70
qg::qg_gom_add_f90
void qg_gom_add_f90(const F90gom &, const F90gom &)
qg::GomQG
GomQG class to handle local model values for QG model.
Definition: GomQG.h:33
qg::GomQG::print
void print(std::ostream &) const
Definition: GomQG.cc:110
qg::qg_gom_schurmult_f90
void qg_gom_schurmult_f90(const F90gom &, const F90gom &)
qg::qg_gom_rms_f90
void qg_gom_rms_f90(const F90gom &, double &)
qg::GomQG::rms
double rms() const
Definition: GomQG.cc:50
qg::GomQG::operator*=
GomQG & operator*=(const double &)
Definition: GomQG.cc:76
qg::qg_gom_random_f90
void qg_gom_random_f90(const F90gom &)
qg::GomQG::operator-=
GomQG & operator-=(const GomQG &)
Definition: GomQG.cc:86
qg::qg_gom_mult_f90
void qg_gom_mult_f90(const F90gom &, const double &)
qg::qg_gom_divide_f90
void qg_gom_divide_f90(const F90gom &, const F90gom &)
qg::GomQG::zero
void zero()
Definition: GomQG.cc:62
qg::qg_gom_zero_f90
void qg_gom_zero_f90(const F90gom &)
qg::qg_gom_stats_f90
void qg_gom_stats_f90(const F90gom &, int &, double &, double &, double &, double &)
qg::qg_gom_create_f90
void qg_gom_create_f90(F90gom &)
qg::GomQG::operator+=
GomQG & operator+=(const GomQG &)
Definition: GomQG.cc:81
qg::qg_gom_read_file_f90
void qg_gom_read_file_f90(const F90gom &, const eckit::Configuration &)
qg::qg_gom_dotprod_f90
void qg_gom_dotprod_f90(const F90gom &, const F90gom &, double &)
oops::Variables
Definition: oops/base/Variables.h:23
qg::GomQG::~GomQG
~GomQG()
Definition: GomQG.cc:46
qg::GomQG::dot_product_with
double dot_product_with(const GomQG &) const
Definition: GomQG.cc:96
Variables.h
qg::qg_gom_copy_f90
void qg_gom_copy_f90(const F90gom &, const F90gom &)
qg::GomQG::write
void write(const eckit::Configuration &) const
Definition: GomQG.cc:106