UFO
AcceptList.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2021 Met Office UK
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_ACCEPTLIST_H_
9 #define UFO_FILTERS_ACCEPTLIST_H_
10 
11 #include <memory>
12 #include <ostream>
13 #include <string>
14 #include <vector>
15 
16 #include "oops/util/ObjectCounter.h"
17 #include "ufo/filters/FilterBase.h"
18 #include "ufo/filters/QCflags.h"
19 
20 namespace eckit {
21  class Configuration;
22 }
23 
24 namespace ioda {
25  template <typename DATATYPE> class ObsDataVector;
26  class ObsSpace;
27 }
28 
29 namespace ufo {
30 
31 /// \brief Parameters controlling the AcceptList filter.
33  // We call this macro instead of "plain" OOPS_CONCRETE_PARAMETERS() because we want to customize
34  // the constructor definition (passing "accept" as the default action name to the base class
35  // constructor).
36  OOPS_CONCRETE_PARAMETERS_ENABLE_COPY_AND_MOVE(AcceptListParameters, FilterParametersBase)
37 
38  public:
39  /// Set the default action to `accept`.
40  explicit AcceptListParameters(oops::Parameters* parent = nullptr)
41  : FilterParametersBase(parent, "accept")
42  {}
43 
44  private:
45  // This filter doesn't take any extra parameters.
46 };
47 
48 /// \brief A filter that, by default, performs the `accept` action on observations selected by the
49 /// `where` clause, i.e. resets the QC flags of these observations to `pass` unless they are
50 /// currently set to 'missing', 'preQC' or 'Hfailed'.
51 class AcceptList : public FilterBase,
52  private util::ObjectCounter<AcceptList> {
53  public:
54  /// The type of parameters accepted by the constructor of this filter.
55  /// This typedef is used by the FilterFactory.
57 
58  static const std::string classname() {return "ufo::AcceptList";}
59 
60  AcceptList(ioda::ObsSpace &, const Parameters_ &,
61  std::shared_ptr<ioda::ObsDataVector<int> >,
62  std::shared_ptr<ioda::ObsDataVector<float> >);
63 
64  private:
65  void print(std::ostream &) const override;
66  void applyFilter(const std::vector<bool> &, const Variables &,
67  std::vector<std::vector<bool>> &) const override;
68  // "black" seems the right flag to use in the unlikely case of this filter's action being set to
69  // "reject" (which is currently the only action that looks at the value returned by
70  // this function).
71  int qcFlag() const override {return QCflags::black;}
72 
74 };
75 
76 } // namespace ufo
77 
78 #endif // UFO_FILTERS_ACCEPTLIST_H_
A filter that, by default, performs the accept action on observations selected by the where clause,...
Definition: AcceptList.h:52
void applyFilter(const std::vector< bool > &, const Variables &, std::vector< std::vector< bool >> &) const override
Definition: AcceptList.cc:35
void print(std::ostream &) const override
Definition: AcceptList.cc:47
AcceptList(ioda::ObsSpace &, const Parameters_ &, std::shared_ptr< ioda::ObsDataVector< int > >, std::shared_ptr< ioda::ObsDataVector< float > >)
Definition: AcceptList.cc:25
AcceptListParameters Parameters_
Definition: AcceptList.h:56
int qcFlag() const override
Definition: AcceptList.h:71
static const std::string classname()
Definition: AcceptList.h:58
Parameters_ parameters_
Definition: AcceptList.h:73
Parameters controlling the AcceptList filter.
Definition: AcceptList.h:32
AcceptListParameters(oops::Parameters *parent=nullptr)
Set the default action to accept.
Definition: AcceptList.h:40
Base class for UFO QC filters.
Definition: FilterBase.h:45
Parameters shared by all filters having a default action (typically "reject").
Forward declarations.
Definition: ObsAodExt.h:21
Forward declarations.
Definition: ObsAodExt.h:25
constexpr int black
Definition: QCflags.h:24
Definition: RunCRTM.h:27