UFO
ProfileFewObsCheck.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_PROFILEFEWOBSCHECK_H_
9 #define UFO_FILTERS_PROFILEFEWOBSCHECK_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 ProfileFewObsCheck filter.
32  OOPS_CONCRETE_PARAMETERS(ProfileFewObsCheckParameters, FilterParametersBase)
33 
34  public:
35  /// The filter will flag profiles which contain fewer than `threshold` number
36  /// of observations
37  oops::RequiredParameter<int> threshold{"threshold", this, {oops::minConstraint(0)}};
38 };
39 
40 /// ProfileFewObsCheck: Check the number of observations in a profile
41 ///
42 /// See the cc file for more details.
43 
45  private util::ObjectCounter<ProfileFewObsCheck> {
46  public:
47  /// The type of parameters accepted by the constructor of this filter.
48  /// This typedef is used by the FilterFactory.
50 
51  static const std::string classname() {return "ufo::ProfileFewObsCheck";}
52 
53  ProfileFewObsCheck(ioda::ObsSpace &, const Parameters_ &,
54  std::shared_ptr<ioda::ObsDataVector<int> >,
55  std::shared_ptr<ioda::ObsDataVector<float> >);
57 
58  private:
59  void print(std::ostream &) const override;
60  void applyFilter(const std::vector<bool> &, const Variables &,
61  std::vector<std::vector<bool>> &) const override;
62  int qcFlag() const override {return QCflags::profile;}
64 };
65 
66 } // namespace ufo
67 
68 #endif // UFO_FILTERS_PROFILEFEWOBSCHECK_H_
Base class for UFO QC filters.
Definition: FilterBase.h:45
Parameters shared by all filters having a default action (typically "reject").
ProfileFewObsCheckParameters Parameters_
ProfileFewObsCheck(ioda::ObsSpace &, const Parameters_ &, std::shared_ptr< ioda::ObsDataVector< int > >, std::shared_ptr< ioda::ObsDataVector< float > >)
static const std::string classname()
void print(std::ostream &) const override
int qcFlag() const override
void applyFilter(const std::vector< bool > &, const Variables &, std::vector< std::vector< bool >> &) const override
Apply the profile check for the number of observations.
Parameters controlling the operation of the ProfileFewObsCheck filter.
oops::RequiredParameter< int > threshold
Forward declarations.
Definition: ObsAodExt.h:25
constexpr int profile
Definition: QCflags.h:34
Definition: RunCRTM.h:27