UFO
ImpactHeightCheck.h
Go to the documentation of this file.
1 /*
2  * (C) British Crown Copyright 2021 Met Office
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_IMPACTHEIGHTCHECK_H_
9 #define UFO_FILTERS_IMPACTHEIGHTCHECK_H_
10 
11 #include <memory>
12 #include <ostream>
13 #include <string>
14 #include <vector>
15 
16 #include "oops/util/ObjectCounter.h"
17 #include "oops/util/parameters/NumericConstraints.h"
18 #include "oops/util/parameters/RequiredParameter.h"
19 #include "oops/util/Printable.h"
20 #include "ufo/filters/FilterBase.h"
21 #include "ufo/filters/QCflags.h"
22 
23 namespace ioda {
24  template <typename DATATYPE> class ObsDataVector;
25  class ObsSpace;
26 }
27 
28 namespace ufo {
29 
30 /// Parameters controlling the operation of the ImpactHeightCheck filter.
32  OOPS_CONCRETE_PARAMETERS(ImpactHeightCheckParameters, FilterParametersBase)
33 
34  public:
35  /// The threshold used to define a sharp gradient in refractivity.
36  /// Units: N-units / m
37  /// Inversions, and possible ducting, are identified by looking for sharp gradients
38  /// in the refractivity. If the refractivity gradient is less than this, then any
39  /// data below this point are rejected.
40  oops::Parameter<float> gradientThreshold{"gradient threshold", -0.08f, this};
41 
42  /// The height (in m) of a buffer-zone for rejecting data above sharp gradients.
43  /// If a sharp gradient in refractivity is identified, then all data above
44  /// this point (plus sharpGradientOffset) is rejected. This parameter makes
45  /// sure that we don't use any data which is too close to the sharp gradient.
46  oops::Parameter<float> sharpGradientOffset{"sharp gradient offset", 500, this};
47 
48  /// Reject data within this height (in m) of the surface.
49  oops::Parameter<float> surfaceOffset{"surface offset", 600, this};
50 };
51 
52 /// ImpactHeightCheck: Calculate the impact height for model profiles, and reject
53 /// any observations which are outside the range of model impact heights. Check
54 /// for any sharp refractivity gradients, and reject any observations below them.
55 /// Refractivity and model heights must have been saved into ObsDiagnostics by
56 /// the observation operator.
57 
59  private util::ObjectCounter<ImpactHeightCheck> {
60  public:
61  /// The type of parameters accepted by the constructor of this filter.
62  /// This typedef is used by the FilterFactory.
64 
65  static const std::string classname() {return "ufo::ImpactHeightCheck";}
66 
67  ImpactHeightCheck(ioda::ObsSpace &, const Parameters_ &,
68  std::shared_ptr<ioda::ObsDataVector<int> >,
69  std::shared_ptr<ioda::ObsDataVector<float> >);
71 
72  private:
73  void print(std::ostream &) const override;
74  void applyFilter(const std::vector<bool> &, const Variables &,
75  std::vector<std::vector<bool>> &) const override;
76  int qcFlag() const override {return QCflags::domain;}
78  std::vector<float> calcVerticalGradient(const std::vector<float> &,
79  const std::vector<float> &) const;
80  float calcImpactHeight(float, float, float) const;
81 };
82 
83 } // namespace ufo
84 
85 #endif // UFO_FILTERS_IMPACTHEIGHTCHECK_H_
Base class for UFO QC filters.
Definition: FilterBase.h:45
Parameters shared by all filters having a default action (typically "reject").
int qcFlag() const override
ImpactHeightCheckParameters Parameters_
float calcImpactHeight(float, float, float) const
std::vector< float > calcVerticalGradient(const std::vector< float > &, const std::vector< float > &) const
ImpactHeightCheck(ioda::ObsSpace &, const Parameters_ &, std::shared_ptr< ioda::ObsDataVector< int > >, std::shared_ptr< ioda::ObsDataVector< float > >)
static const std::string classname()
void applyFilter(const std::vector< bool > &, const Variables &, std::vector< std::vector< bool >> &) const override
void print(std::ostream &) const override
Parameters controlling the operation of the ImpactHeightCheck filter.
oops::Parameter< float > sharpGradientOffset
oops::Parameter< float > surfaceOffset
Reject data within this height (in m) of the surface.
oops::Parameter< float > gradientThreshold
Forward declarations.
Definition: ObsAodExt.h:25
constexpr int domain
Definition: QCflags.h:23
Definition: RunCRTM.h:27