UFO
ObsErrorFactorSfcPressure.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2020 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_OBSERRORFACTORSFCPRESSURE_H_
9 #define UFO_FILTERS_OBSFUNCTIONS_OBSERRORFACTORSFCPRESSURE_H_
10 
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 #include "oops/util/parameters/Parameter.h"
16 #include "oops/util/parameters/Parameters.h"
17 #include "oops/util/parameters/RequiredParameter.h"
18 
21 #include "ufo/filters/Variables.h"
23 
24 namespace ufo {
25 
26 /// \brief Options controlling ObsErrorFactorSfcPressure ObsFunction
27 class ObsErrorFactorSfcPressureParameters : public oops::Parameters {
28  OOPS_CONCRETE_PARAMETERS(ObsErrorFactorSfcPressureParameters, Parameters)
29 
30  public:
31  /// the existence of min,max error values are required
32  oops::RequiredParameter<float> error_min{"error_min", this};
33  oops::RequiredParameter<float> error_max{"error_max", this};
34  oops::Parameter<std::string> original_obserr{"original_obserr", "ObsErrorData", this};
35  oops::Parameter<std::string> geovar_sfc_geomz{"geovar_sfc_geomz", "surface_altitude", this};
36  oops::Parameter<std::string> geovar_temp{"geovar_temp", "virtual_temperature", this};
37 };
38 
39 // -----------------------------------------------------------------------------
40 
41 /// \brief Inflate the observation error for surface pressure as done by GSI-Observer.
42 ///
43 /// This routine was designed to mimic the GSI observer code (i.e., setupps.f90) to inflate
44 /// the observation error for surface pressure using the following inputs:
45 /// Observed surface pressure, station height, and temperature (possibly missing).
46 /// Model first-guess fields interpolated to the observation location.
47 /// The starting obserror is then altered by this code with the "inflate error" action,
48 /// constrained by the values given for error_min and error_max (Pa). For testing
49 /// purposes, the optional parameter of original_obserr group name such as ObsError to
50 /// override the default ObsErrorData can be used for tolerance check of reference results.
51 /// Internally, the code expects to find surface_altitude@GeoVaLs, however, some datasets
52 /// may have surface_geopotential_height@GeoVaLs in its place. Also, the model vertical
53 /// profile of temperature is assumed to be virtual_temperature@GeoVaLs, but can be overriden
54 /// using geovar_temp option set to air_temperature for example.
55 ///
56 /// ~~~~
57 ///
58 /// ### example configurations for a FilterBase derived class: ###
59 ///
60 /// - filter: BlackList
61 /// filter variables:
62 /// - name: surface_pressure
63 /// action:
64 /// name: inflate error
65 /// inflation variable:
66 /// name: ObsErrorFactorSfcPressure@ObsFunction
67 /// options:
68 /// error_min: 100 # 1 mb
69 /// error_max: 300 # 3 mb
70 /// geovar_sfc_geomz: surface_geopotential_height # default is surface_altitude
71 ///
72 class ObsErrorFactorSfcPressure : public ObsFunctionBase<float> {
73  public:
74  static const std::string classname() {return "ObsErrorFactorSfcPressure";}
75 
76  explicit ObsErrorFactorSfcPressure(const eckit::Configuration &config);
77  ~ObsErrorFactorSfcPressure();
78 
79  void compute(const ObsFilterData &, ioda::ObsDataVector<float> &) const;
80  const ufo::Variables & requiredVariables() const;
81  private:
82  ufo::Variables invars_;
83  std::unique_ptr<ObsErrorFactorSfcPressureParameters> options_;
84 };
85 
86 // -----------------------------------------------------------------------------
87 
88 } // namespace ufo
89 
90 #endif // UFO_FILTERS_OBSFUNCTIONS_OBSERRORFACTORSFCPRESSURE_H_
Options controlling ObsErrorFactorSfcPressure ObsFunction.
oops::RequiredParameter< float > error_min
the existence of min,max error values are required
oops::Parameter< std::string > geovar_sfc_geomz
oops::RequiredParameter< float > error_max
oops::Parameter< std::string > original_obserr
Definition: RunCRTM.h:27