FV3 Bundle
oops/src/oops/interface/ObsCheck.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-2018 UCAR
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  */
7 
8 #ifndef OOPS_INTERFACE_OBSCHECK_H_
9 #define OOPS_INTERFACE_OBSCHECK_H_
10 
11 #include <string>
12 
13 #include <boost/noncopyable.hpp>
14 #include <boost/scoped_ptr.hpp>
15 
16 #include "eckit/config/LocalConfiguration.h"
17 #include "oops/base/FilterBase.h"
18 #include "oops/interface/GeoVaLs.h"
21 #include "oops/util/dot_product.h"
22 #include "oops/util/Logger.h"
23 
24 namespace oops {
25 
26 // -----------------------------------------------------------------------------
27 
28 template <typename MODEL>
29 class ObsCheck : public FilterBase<MODEL> {
30  typedef typename MODEL::ObsCheck ObsCheck_;
34 
35  public:
36  static const std::string classname() {return "oops::ObsCheck";}
37 
38  explicit ObsCheck(const ObsSpace_ &);
39  explicit ObsCheck(const eckit::Configuration & conf);
40  ~ObsCheck();
41 
42 /// Interfacing
43  const ObsCheck_ & obscheck() const {return *obsc_;}
44  ObsCheck_ & obscheck() {return *obsc_;}
45 
46  void postFilter(const GeoVaLs_ &, const ObsVector_ &, const ObsSpace_ &) const;
47  void priorFilter(const ObsSpace_ &) const;
48 
49  private:
50  const eckit::LocalConfiguration conf_;
51  void print(std::ostream &) const override;
52  boost::scoped_ptr<ObsCheck_> obsc_;
53 };
54 
55 // -----------------------------------------------------------------------------
56 
57 template <typename MODEL>
58 ObsCheck<MODEL>::ObsCheck(const eckit::Configuration & conf) : conf_(conf) {
59  Log::trace() << "ObsCheck<MODEL>::ObsCheck Configuration starting" << std::endl;
60  util::Timer timer(classname(), "ObsCheck");
61  obsc_.reset(new ObsCheck_(conf));
62  Log::trace() << "ObsCheck<MODEL>::ObsCheck Configuration done" << std::endl;
63 }
64 
65 // -----------------------------------------------------------------------------
66 
67 template <typename MODEL>
68 ObsCheck<MODEL>::ObsCheck(const ObsSpace_ & os) : obsc_() {
69  Log::trace() << "ObsCheck<MODEL>::ObsCheck ObsSpace starting" << std::endl;
70  util::Timer timer(classname(), "ObsCheck");
71  Log::trace() << "ObsCheck<MODEL>::ObsCheck ObsSpace done" << std::endl;
72 }
73 
74 // -----------------------------------------------------------------------------
75 
76 template <typename MODEL>
78  Log::trace() << "ObsCheck<MODEL>::~ObsCheck starting" << std::endl;
79  util::Timer timer(classname(), "~ObsCheck");
80  obsc_.reset();
81  Log::trace() << "ObsCheck<MODEL>::~ObsCheck done" << std::endl;
82 }
83 
84 // -----------------------------------------------------------------------------
85 
86 template <typename MODEL>
87 void ObsCheck<MODEL>::postFilter(const GeoVaLs_ & gv, const ObsVector_ & ov,
88  const ObsSpace_ & os) const {
89  Log::trace() << "ObsCheck<MODEL>::postFilter starting" << std::endl;
90  util::Timer timer(classname(), "ObsCheck");
91  obsc_->postFilter(gv.geovals(), ov.obsvector(), os.observationspace());
92  Log::trace() << "ObsCheck<MODEL>::postFilter done" << std::endl;
93 }
94 
95 // -----------------------------------------------------------------------------
96 
97 template <typename MODEL>
98 void ObsCheck<MODEL>::priorFilter(const ObsSpace_ & os) const {
99  Log::trace() << "ObsCheck<MODEL>:: priorFilter starting" << std::endl;
100  util::Timer timer(classname(), "ObsCheck");
101  obsc_->priorFilter(os.observationspace());
102  Log::trace() << "ObsCheck<MODEL>:: priorFilter done" << std::endl;
103 }
104 
105 // -----------------------------------------------------------------------------
106 
107 template <typename MODEL>
108 void ObsCheck<MODEL>::print(std::ostream & os) const {
109  os << "ObsCheck " << conf_;
110 }
111 
112 // -----------------------------------------------------------------------------
113 
114 } // namespace oops
115 
116 #endif // OOPS_INTERFACE_OBSCHECK_H_
Base class for QC filters applied to observations.
Definition: FilterBase.h:29
const GeoVaLs_ & geovals() const
Interfacing.
const eckit::LocalConfiguration conf_
Definition: conf.py:1
static const std::string classname()
const ObsCheck_ & obscheck() const
Interfacing.
The namespace for the main oops code.
ObservationSpace< MODEL > ObsSpace_
ObsVector_ & obsvector()
Interfacing.
void postFilter(const GeoVaLs_ &, const ObsVector_ &, const ObsSpace_ &) const
void priorFilter(const ObsSpace_ &) const
ObsSpace_ & observationspace() const
Interfacing.
void print(std::ostream &) const override
boost::scoped_ptr< ObsCheck_ > obsc_