UFO
ObsErrorDiagonal.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2021 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 UFO_ERRORS_OBSERRORDIAGONAL_H_
9 #define UFO_ERRORS_OBSERRORDIAGONAL_H_
10 
11 #include <memory>
12 #include <string>
13 
14 #include "eckit/config/Configuration.h"
15 
16 #include "ioda/ObsVector.h"
17 
18 #include "oops/interface/ObsErrorBase.h"
19 #include "oops/util/parameters/Parameter.h"
20 #include "oops/util/parameters/Parameters.h"
21 
22 #include "ufo/ObsTraits.h"
23 
24 namespace eckit {
25  class Configuration;
26 }
27 
28 namespace ioda {
29  class ObsSpace;
30 }
31 
32 namespace ufo {
33 
34 /// \brief Parameters for diagonal obs errors
35 class ObsErrorDiagonalParameters : public oops::ObsErrorParametersBase {
36  OOPS_CONCRETE_PARAMETERS(ObsErrorDiagonalParameters, ObsErrorParametersBase)
37  public:
38  /// perturbation amplitude multiplier
39  oops::Parameter<double> pert{"random amplitude", 1.0, this};
40 };
41 
42 // -----------------------------------------------------------------------------
43 /// \brief Diagonal observation error covariance matrix.
44 class ObsErrorDiagonal : public oops::interface::ObsErrorBase<ObsTraits> {
45  public:
46  /// The type of parameters passed to the constructor.
47  /// This typedef is used by the ObsErrorFactory.
49 
50  static const std::string classname() {return "ufo::ObsErrorDiagonal";}
51 
52  ObsErrorDiagonal(const Parameters_ &, ioda::ObsSpace &,
53  const eckit::mpi::Comm &timeComm);
54 
55 /// Update after obs errors potentially changed
56  void update(const ioda::ObsVector &) override;
57 
58 /// Multiply a Departure by \f$R\f$
59  void multiply(ioda::ObsVector &) const override;
60 
61 /// Multiply a Departure by \f$R^{-1}\f$
62  void inverseMultiply(ioda::ObsVector &) const override;
63 
64 /// Generate random perturbation
65  void randomize(ioda::ObsVector &) const override;
66 
67 /// Save obs errors
68  void save(const std::string &) const override;
69 
70 /// Get mean error for Jo table
71  double getRMSE() const override {return stddev_.rms();}
72 
73 /// Get obs errors std deviation
74  std::unique_ptr<ioda::ObsVector> getObsErrors() const override;
75 
76 /// Return inverseVariance
77  std::unique_ptr<ioda::ObsVector> getInverseVariance() const override;
78 
79  private:
80  void print(std::ostream &) const override;
81  ioda::ObsVector stddev_;
82  ioda::ObsVector inverseVariance_;
84 };
85 
86 // -----------------------------------------------------------------------------
87 
88 } // namespace ufo
89 
90 #endif // UFO_ERRORS_OBSERRORDIAGONAL_H_
Diagonal observation error covariance matrix.
void randomize(ioda::ObsVector &) const override
Generate random perturbation.
std::unique_ptr< ioda::ObsVector > getInverseVariance() const override
Return inverseVariance.
void inverseMultiply(ioda::ObsVector &) const override
Multiply a Departure by .
ObsErrorDiagonalParameters Parameters_
void print(std::ostream &) const override
ioda::ObsVector stddev_
static const std::string classname()
ObsErrorDiagonal(const Parameters_ &, ioda::ObsSpace &, const eckit::mpi::Comm &timeComm)
void update(const ioda::ObsVector &) override
Update after obs errors potentially changed.
ioda::ObsVector inverseVariance_
double getRMSE() const override
Get mean error for Jo table.
void multiply(ioda::ObsVector &) const override
Multiply a Departure by .
void save(const std::string &) const override
Save obs errors.
std::unique_ptr< ioda::ObsVector > getObsErrors() const override
Get obs errors std deviation.
Parameters for diagonal obs errors.
oops::Parameter< double > pert
perturbation amplitude multiplier
Forward declarations.
Definition: ObsAodExt.h:21
Forward declarations.
Definition: ObsAodExt.h:25
Definition: RunCRTM.h:27