UFO
DataHandlerParameters.h
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2020, 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_PROFILE_DATAHANDLERPARAMETERS_H_
9 #define UFO_PROFILE_DATAHANDLERPARAMETERS_H_
10 
11 #include <string>
12 #include <vector>
13 
14 #include "oops/util/parameters/Parameter.h"
15 #include "oops/util/parameters/Parameters.h"
16 
17 namespace eckit {
18  class Configuration;
19 }
20 
21 namespace ufo {
22 
23  /// \brief Options controlling the operation of the EntireSampleDataHandler
24  /// and ProfileDataHandler classes.
25  class DataHandlerParameters : public oops::Parameters {
26  OOPS_ABSTRACT_PARAMETERS(DataHandlerParameters, Parameters)
27 
28  public: // functions
29  /// Determine whether a variable group is optional or not.
30  bool getOptional(const std::string &groupname) const
31  {
32  bool optional = false;
33  if (std::find(groups_optional.value().begin(), groups_optional.value().end(), groupname)
34  != groups_optional.value().end())
35  optional = true;
36  return optional;
37  }
38 
39  /// Determine number of entries per profile for a variable group.
40  size_t getEntriesPerProfile(const std::string &groupname) const
41  {
42  size_t entriesPerProfile = 0;
43  // Variables with one entry per profile.
44  if (std::find(groups_singlevalue.value().begin(), groups_singlevalue.value().end(), groupname)
45  != groups_singlevalue.value().end()) {
46  entriesPerProfile = 1;
47  }
48  return entriesPerProfile;
49  }
50 
51  public: // variables
52  /// Groups of variables whose presence in the input sample is optional
53  /// (if not present, all variables are initially set to zero).
54  oops::Parameter<std::vector<std::string>> groups_optional
55  {"groups_optional", {"Corrections", "Counters"}, this};
56 
57  /// Groups of variables which have one value per profile.
58  oops::Parameter<std::vector<std::string>> groups_singlevalue
59  {"groups_singlevalue", {"Counters"}, this};
60 
61  /// Number of errors, accumulated over checks, that cause the observation to have failed.
62  oops::Parameter<int> nErrorsFail {"nErrorsFail", 1, this};
63  };
64 } // namespace ufo
65 
66 #endif // UFO_PROFILE_DATAHANDLERPARAMETERS_H_
67 
ufo::DataHandlerParameters::nErrorsFail
oops::Parameter< int > nErrorsFail
Number of errors, accumulated over checks, that cause the observation to have failed.
Definition: DataHandlerParameters.h:62
ufo
Definition: RunCRTM.h:27
eckit
Forward declarations.
Definition: ObsAtmSfcInterp.h:20
ufo::DataHandlerParameters
Options controlling the operation of the EntireSampleDataHandler and ProfileDataHandler classes.
Definition: DataHandlerParameters.h:25
ufo::DataHandlerParameters::getOptional
bool getOptional(const std::string &groupname) const
Determine whether a variable group is optional or not.
Definition: DataHandlerParameters.h:30
ufo::DataHandlerParameters::getEntriesPerProfile
size_t getEntriesPerProfile(const std::string &groupname) const
Determine number of entries per profile for a variable group.
Definition: DataHandlerParameters.h:40
ufo::DataHandlerParameters::groups_optional
oops::Parameter< std::vector< std::string > > groups_optional
Definition: DataHandlerParameters.h:55
ufo::DataHandlerParameters::groups_singlevalue
oops::Parameter< std::vector< std::string > > groups_singlevalue
Groups of variables which have one value per profile.
Definition: DataHandlerParameters.h:59