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 <map>
12 #include <string>
13 #include <vector>
14 
15 #include "oops/util/parameters/OptionalParameter.h"
16 #include "oops/util/parameters/Parameter.h"
17 #include "oops/util/parameters/Parameters.h"
18 
20 
21 namespace eckit {
22  class Configuration;
23 }
24 
25 namespace ufo {
26 
27  /// \brief Options controlling the operation of the EntireSampleDataHandler
28  /// and ProfileDataHandler classes.
29  class DataHandlerParameters : public oops::Parameters {
30  OOPS_CONCRETE_PARAMETERS(DataHandlerParameters, Parameters)
31 
32  public: // functions
33  /// Determine whether a variable group is optional or not.
34  bool getOptional(const std::string &groupname) const
35  {
36  bool optional = false;
37  if (std::find(groups_optional.value().begin(), groups_optional.value().end(), groupname)
38  != groups_optional.value().end())
39  optional = true;
40  return optional;
41  }
42 
43  /// Determine number of entries per profile for a variable group.
44  size_t getEntriesPerProfile(const std::string &groupname) const
45  {
46  size_t entriesPerProfile = 0;
47  // Variables with one entry per profile.
48  if (std::find(groups_singlevalue.value().begin(),
49  groups_singlevalue.value().end(), groupname)
50  != groups_singlevalue.value().end()) {
51  entriesPerProfile = 1;
52  } else if (std::find(groups_modellevels.value().begin(),
53  groups_modellevels.value().end(), groupname)
54  != groups_modellevels.value().end()) {
55  entriesPerProfile = ModParameters.numModelLevels();
56  } else if (std::find(groups_modelrholevels.value().begin(),
57  groups_modelrholevels.value().end(), groupname)
58  != groups_modelrholevels.value().end()) {
59  entriesPerProfile = ModParameters.numModelLevels_rho();
60  }
61  return entriesPerProfile;
62  }
63 
64  public: // variables
65  /// Groups of variables whose presence in the input sample is optional
66  /// (if not present, all variables are initially set to zero).
67  oops::Parameter<std::vector<std::string>> groups_optional
68  {"groups_optional", {"Corrections", "Counters"}, this};
69 
70  /// Groups of variables which have one value per profile.
71  oops::Parameter<std::vector<std::string>> groups_singlevalue
72  {"groups_singlevalue", {}, this};
73 
74  /// Groups of variables which are on model levels.
75  oops::Parameter<std::vector<std::string>> groups_modellevels
76  {"groups_modellevels",
77  {"ModelLevelsDerivedValue", "ModelLevelsQCFlags"}, this};
78 
79  /// Groups of variables which are on model rho levels.
80  oops::Parameter<std::vector<std::string>> groups_modelrholevels
81  {"groups_modelrholevels",
82  {"ModelRhoLevelsDerivedValue", "ModelRhoLevelsFlags"}, this};
83 
84  /// Number of errors, accumulated over checks, that cause the observation to have failed.
85  oops::Parameter<int> nErrorsFail {"nErrorsFail", 1, this};
86 
87  /// Maximum number of profile levels to be processed (a legacy of the OPS code).
88  /// No maximum is assigned if this parameter is not specified.
89  oops::OptionalParameter<int> maxlev {"maxlev", this};
90 
91  /// If not sorting observations, ensure number of profiles is consistent
92  oops::Parameter<bool> ValidateTotalNumProf {"ValidateTotalNumProf", true, this};
93 
94  /// Output filename for saving derived values on model levels.
95  oops::Parameter<std::string> ModelLevelsDerivedValuesFilename
96  {"ModelLevelsDerivedValuesFilename", "ModelLevelsDerivedValues.nc4", this};
97 
98  /// Default vertical coordinate to use in the slant path location algorithm.
99  /// This can be overridden for each variable by using the \p alternativeVerticalCoordinate
100  /// option.
101  oops::Parameter<std::string> defaultVerticalCoordinate
102  {"defaultVerticalCoordinate", "air_pressure", this};
103 
104  /// Alternative vertical coordinate(s) to use in the slant path location algorithm.
105  /// The first string in each pair is the name of the variable whose slanted profile is to
106  /// be determined, and the second string is the vertical coordinate that should be used to
107  /// find the slant path locations for the variable.
108  /// This will typically be useful for models whose variables appear on staggered vertical levels
109  /// (e.g. with vertical coordinates 'air_pressure' and 'air_pressure_levels').
110  oops::Parameter<std::map<std::string, std::string>> alternativeVerticalCoordinate
111  {"alternativeVerticalCoordinate",
112  {{"eastward_wind", "air_pressure_levels"}, {"northward_wind", "air_pressure_levels"},
113  {"ExnerPA", "air_pressure_levels"}, {"LogPA", "air_pressure_levels"}}, this};
114 
115  /// Parameters related to the model.
117  };
118 } // namespace ufo
119 
120 #endif // UFO_PROFILE_DATAHANDLERPARAMETERS_H_
121 
Options controlling the operation of the EntireSampleDataHandler and ProfileDataHandler classes.
oops::OptionalParameter< int > maxlev
oops::Parameter< bool > ValidateTotalNumProf
If not sorting observations, ensure number of profiles is consistent.
oops::Parameter< int > nErrorsFail
Number of errors, accumulated over checks, that cause the observation to have failed.
oops::Parameter< std::vector< std::string > > groups_singlevalue
Groups of variables which have one value per profile.
size_t getEntriesPerProfile(const std::string &groupname) const
Determine number of entries per profile for a variable group.
oops::Parameter< std::vector< std::string > > groups_modellevels
Groups of variables which are on model levels.
ModelParameters ModParameters
Parameters related to the model.
oops::Parameter< std::vector< std::string > > groups_optional
oops::Parameter< std::vector< std::string > > groups_modelrholevels
Groups of variables which are on model rho levels.
oops::Parameter< std::string > defaultVerticalCoordinate
bool getOptional(const std::string &groupname) const
Determine whether a variable group is optional or not.
oops::Parameter< std::string > ModelLevelsDerivedValuesFilename
Output filename for saving derived values on model levels.
oops::Parameter< std::map< std::string, std::string > > alternativeVerticalCoordinate
Options related to GeoVaLs used in the profile QC code.
size_t numModelLevels() const
Number of model theta levels.
size_t numModelLevels_rho() const
Forward declarations.
Definition: ObsAodExt.h:21
Definition: RunCRTM.h:27