UFO
ObsErrorFactorQuotient.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_FILTERS_OBSFUNCTIONS_OBSERRORFACTORQUOTIENT_H_
9 #define UFO_FILTERS_OBSFUNCTIONS_OBSERRORFACTORQUOTIENT_H_
10 
11 #include <string>
12 #include <vector>
13 
14 #include "ioda/ObsDataVector.h"
15 
16 #include "oops/util/parameters/Parameter.h"
17 #include "oops/util/parameters/Parameters.h"
18 #include "oops/util/parameters/RequiredParameter.h"
19 
22 #include "ufo/filters/Variables.h"
24 
25 namespace ufo {
26 
27 /// \brief Options controlling ObsErrorFactorQuotient ObsFunction
28 class ObsErrorFactorQuotientParameters : public oops::Parameters {
29  OOPS_CONCRETE_PARAMETERS(ObsErrorFactorQuotientParameters, Parameters)
30 
31  public:
32  /// the name of the numerator and denominator variables (with group names).
33  oops::RequiredParameter<Variable> numerator{"numerator", this};
34  oops::RequiredParameter<Variable> denominator{"denominator", this};
35  oops::Parameter<bool> save{"save", false, this};
36 };
37 
38 // -----------------------------------------------------------------------------
39 
40 /// \brief Calculate the ratio of two variables, typically related to ObsError
41 ///
42 /// This routine was designed to mimic the GSI-Observer method of rejecting obs data
43 /// when the ratio of the final ObsError, after inflation, is more than a threshold
44 /// amount greater than the starting ObsError. A boolean optional save variable
45 /// is available, false by default. The ObsFunction is simple division expected to
46 /// be used with Bounds Check above a maximum threshold.
47 ///
48 /// ### example configurations for a FilterBase derived class: ###
49 ///
50 /// - Filter: Bounds Check
51 /// filter variables:
52 /// - name: air_temperature
53 /// action:
54 /// name: reject
55 /// maxvalue: 3.6
56 /// test variables:
57 /// - name: ObsErrorFactorQuotient@ObsFunction
58 /// options:
59 /// numerator:
60 /// name: air_temperature@ObsErrorData # After inflation step
61 /// denominator:
62 /// name: air_temperature@ObsError
63 /// defer to post: true # Likely necessary for order of filters
64 ///
65 class ObsErrorFactorQuotient : public ObsFunctionBase<float> {
66  public:
67  static const std::string classname() {return "ObsErrorFactorQuotient";}
68 
69  explicit ObsErrorFactorQuotient(const eckit::LocalConfiguration);
71 
72  void compute(const ObsFilterData &, ioda::ObsDataVector<float> &) const;
73  const ufo::Variables & requiredVariables() const;
74  private:
77 };
78 
79 // -----------------------------------------------------------------------------
80 
81 } // namespace ufo
82 
83 #endif // UFO_FILTERS_OBSFUNCTIONS_OBSERRORFACTORQUOTIENT_H_
Calculate the ratio of two variables, typically related to ObsError.
const ufo::Variables & requiredVariables() const
geovals required to compute the function
ObsErrorFactorQuotient(const eckit::LocalConfiguration)
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
ObsErrorFactorQuotientParameters options_
static const std::string classname()
Options controlling ObsErrorFactorQuotient ObsFunction.
oops::RequiredParameter< Variable > denominator
oops::RequiredParameter< Variable > numerator
the name of the numerator and denominator variables (with group names).
ObsFilterData provides access to all data related to an ObsFilter.
Definition: RunCRTM.h:27