UFO
ProfileSondeFlags.cc
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 
9 
10 namespace ufo {
11 
12  static ProfileCheckMaker<ProfileSondeFlags>
13  makerProfileSondeFlags_("SondeFlags");
14 
17  : ProfileCheckBase(options)
18  {}
19 
21  {
22  oops::Log::debug() << " Set sonde QC Flags" << std::endl;
23 
24  const int numProfileLevels = profileDataHandler.getNumProfileLevels();
25 
26  std::vector <int> &tFlags =
27  profileDataHandler.get<int>(ufo::VariableNames::qcflags_air_temperature);
28  std::vector <int> &rhFlags =
29  profileDataHandler.get<int>(ufo::VariableNames::qcflags_relative_humidity);
30  std::vector <int> &uFlags =
31  profileDataHandler.get<int>(ufo::VariableNames::qcflags_eastward_wind);
32  std::vector <int> &vFlags =
33  profileDataHandler.get<int>(ufo::VariableNames::qcflags_northward_wind);
34  const std::vector <int> &ObsType =
35  profileDataHandler.get<int>(ufo::VariableNames::ObsType);
36  const std::vector <int> &LevelType =
37  profileDataHandler.get<int>(ufo::VariableNames::LevelType);
38 
39  if (!oops::allVectorsSameNonZeroSize(tFlags, rhFlags, uFlags, vFlags,
40  ObsType, LevelType)) {
41  oops::Log::warning() << "At least one vector is the wrong size. "
42  << "Check will not be performed." << std::endl;
43  oops::Log::warning() << "Vector sizes: "
44  << oops::listOfVectorSizes(tFlags, rhFlags, uFlags, vFlags,
45  ObsType, LevelType)
46  << std::endl;
47  return;
48  }
49 
50  // Do not perform for wind profilers.
52  return;
53 
54  // Check whether BUFR data or not and set flags to check accordingly.
55  const bool isBUFR = (ObsType[0] == ufo::MetOfficeObsIDs::AtmosphericProfile::Sonde ||
57  const int IBSigWind = isBUFR ? ufo::MetOfficeQCFlags::Sounding::BUFRSigWind :
59  const int IBSigTemp = isBUFR ? ufo::MetOfficeQCFlags::Sounding::BUFRSigTemp :
61  const int IBMaxWind = isBUFR ? ufo::MetOfficeQCFlags::Sounding::BUFRMaxWind :
63  const int IBTropopause = isBUFR ? ufo::MetOfficeQCFlags::Sounding::BUFRTropopause :
65  const int IBStandard = isBUFR ? ufo::MetOfficeQCFlags::Sounding::BUFRStandard :
67  const int IBStandardX = isBUFR ? ufo::MetOfficeQCFlags::Sounding::BUFRStandardX :
69  const int IBSurface = isBUFR ? ufo::MetOfficeQCFlags::Sounding::BUFRSurface :
71 
72  // Set flags on each level.
73  for (size_t jlev = 0; jlev < numProfileLevels; ++jlev) {
74  if (LevelType[jlev] == missingValueInt) continue;
75 
76  // Surface level
77  if (LevelType[jlev] & IBSurface) {
79  tFlags, rhFlags, uFlags, vFlags);
80  }
81 
82  // Standard level
83  if (LevelType[jlev] & IBStandard || LevelType[jlev] & IBStandardX) {
85  tFlags, rhFlags, uFlags, vFlags);
86  }
87 
88  // Tropopause
89  if (LevelType[jlev] & IBTropopause) {
91  tFlags, rhFlags, uFlags, vFlags);
92  }
93 
94  // Maximum wind level
95  if (LevelType[jlev] & IBMaxWind) {
97  uFlags, vFlags);
98  }
99 
100  // Significant temperature level
101  if (LevelType[jlev] & IBSigTemp) {
103  }
104 
105  // Significant wind level
106  if (LevelType[jlev] & IBSigWind) {
108  uFlags, vFlags);
109  }
110  }
111  }
112 } // namespace ufo
Options controlling the operation of the ConventionalProfileProcessing filter.
Profile QC checker base class.
void SetQCFlag(const int &flag, const size_t &jlev, std::vector< T > &vec)
const int missingValueInt
Missing value (int)
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
std::vector< T > & get(const std::string &fullname)
int getNumProfileLevels() const
Return number of levels to which QC checks should be applied.
void runCheck(ProfileDataHandler &profileDataHandler) override
Run check.
ProfileSondeFlags(const ConventionalProfileProcessingParameters &options)
@ BUFRMaxWind
Maximum wind level.
@ BUFRSigTemp
Significant temperature level.
@ BUFRStandardX
Semi-standard level, grouped with standard levels in this case.
@ TEMPMaxWind
Maximum wind level.
@ TEMPSurface
Surface level.
@ TEMPSigWind
Significant wind level.
@ BUFRTropopause
Tropopause level.
@ TEMPSigTemp
Significant temperature level.
@ TEMPTropopause
Tropopause level.
@ TEMPStandard
Standard level.
@ BUFRSurface
Surface level.
@ BUFRSigWind
Significant wind level.
@ TEMPStandardX
Semi-standard level.
@ BUFRStandard
Standard level.
@ TropopauseFlag
Tropopause Level.
@ MaxWindLevelFlag
Maximum Wind Level.
@ SurfaceLevelFlag
Surface Level.
@ SigTempLevelFlag
Significant Temperature.
@ StandardLevelFlag
Standard Level.
@ SigWindLevelFlag
Significant Wind Level.
Definition: RunCRTM.h:27
static ProfileCheckMaker< ProfileSondeFlags > makerProfileSondeFlags_("SondeFlags")
static constexpr const char *const qcflags_eastward_wind
static constexpr const char *const qcflags_northward_wind
static constexpr const char *const qcflags_relative_humidity
static constexpr const char *const ObsType
Definition: VariableNames.h:87
static constexpr const char *const qcflags_air_temperature
Definition: VariableNames.h:99
static constexpr const char *const LevelType
Definition: VariableNames.h:92