UFO
ProfileCheckBackgroundWindSpeed.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<ProfileCheckBackgroundWindSpeed>
13  makerProfileCheckBackgroundWindSpeed_("BackgroundWindSpeed");
14 
16  (const ProfileConsistencyCheckParameters &options,
17  const ProfileIndices &profileIndices,
18  ProfileDataHandler &profileDataHandler,
19  ProfileCheckValidator &profileCheckValidator)
20  : ProfileCheckBase(options, profileIndices, profileDataHandler, profileCheckValidator)
21  {}
22 
24  {
25  oops::Log::debug() << " Background check for wind velocity" << std::endl;
26 
27  const size_t numLevelsToCheck = profileIndices_.getNumLevelsToCheck();
28  const bool ModelLevels = options_.modellevels.value();
29  const std::vector <float> &uObs =
31  const std::vector <float> &uObsErr =
33  const std::vector <float> &uBkg =
35  const std::vector <float> &uBkgErr =
37  std::vector <float> &uPGE =
39  std::vector <float> &uPGEBd =
41  std::vector <int> &uFlags =
43  const std::vector <float> &vObs =
45  const std::vector <float> &vObsErr =
47  const std::vector <float> &vBkg =
49  const std::vector <float> &vBkgErr =
51  std::vector <float> &vPGE =
53  std::vector <float> &vPGEBd =
55  std::vector <int> &vFlags =
57  const std::vector <int> &timeFlags =
59 
60  if (!oops::allVectorsSameNonZeroSize(uObs, uObsErr, uBkg, uBkgErr,
61  uPGE, uFlags,
62  vObs, vObsErr, vBkg, vBkgErr,
63  vPGE, vFlags, timeFlags)) {
64  oops::Log::warning() << "At least one vector is the wrong size. "
65  << "Check will not be performed." << std::endl;
66  oops::Log::warning() << "Vector sizes: "
67  << oops::listOfVectorSizes(uObs, uObsErr, uBkg, uBkgErr,
68  uPGE, uFlags,
69  vObs, vObsErr, vBkg, vBkgErr,
70  vPGE, vFlags, timeFlags)
71  << std::endl;
72  return;
73  }
74 
75  // Probability density of 'bad' observations.
76  std::vector <float> PdBad(numLevelsToCheck, options_.BkCheck_PdBad_uv.value());
77 
78  // Modify observation PGE if certain flags have been set.
79  for (int jlev = 0; jlev < numLevelsToCheck; ++jlev) {
81  uPGE[jlev] = 0.5 + 0.5 * uPGE[jlev];
82  if (timeFlags[jlev])
84  }
85 
86  // Calculate probability of gross error.
88  uObs,
89  uObsErr,
90  uBkg,
91  uBkgErr,
92  PdBad,
93  ModelLevels,
94  uFlags,
95  uPGE,
96  uPGEBd,
97  -1,
98  &vObs,
99  &vBkg);
100 
101  // Update v PGE and flags.
102  vPGE = uPGE;
103  vFlags = uFlags;
104  vPGEBd = uPGEBd;
105  }
106 } // namespace ufo
ufo::ProfileDataHandler
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
Definition: ProfileDataHandler.h:40
ufo::VariableNames::obs_northward_wind
static constexpr const char *const obs_northward_wind
Definition: VariableNames.h:22
ufo::ProfileConsistencyCheckParameters::BkCheck_PdBad_uv
oops::Parameter< float > BkCheck_PdBad_uv
Prior probability of 'bad' observations for u and v.
Definition: ProfileConsistencyCheckParameters.h:272
ufo::ProfileCheckBackgroundWindSpeed::ProfileCheckBackgroundWindSpeed
ProfileCheckBackgroundWindSpeed(const ProfileConsistencyCheckParameters &options, const ProfileIndices &profileIndices, ProfileDataHandler &profileDataHandler, ProfileCheckValidator &profileCheckValidator)
Definition: ProfileCheckBackgroundWindSpeed.cc:16
ufo::MetOfficeQCFlags::PermRejectFlag
@ PermRejectFlag
Blacklisted data.
Definition: MetOfficeQCFlags.h:57
ufo::ProfileCheckBase::profileIndices_
const ProfileIndices & profileIndices_
Indices of profile's observations in the entire sample.
Definition: ProfileCheckBase.h:74
ufo::ProfileIndices
Determine indices of observations making up individual profiles. The indices are computed with respec...
Definition: ProfileIndices.h:39
ufo::ProfileCheckBase::profileDataHandler_
ProfileDataHandler & profileDataHandler_
Profile data handler.
Definition: ProfileCheckBase.h:77
ufo::ProfileIndices::getNumLevelsToCheck
int getNumLevelsToCheck() const
Return number of levels to which QC checks should be applied.
Definition: ProfileIndices.h:52
ufo::VariableNames::qcflags_northward_wind
static constexpr const char *const qcflags_northward_wind
Definition: VariableNames.h:96
ufo::makerProfileCheckBackgroundWindSpeed_
static ProfileCheckMaker< ProfileCheckBackgroundWindSpeed > makerProfileCheckBackgroundWindSpeed_("BackgroundWindSpeed")
ufo::VariableNames::pge_northward_wind
static constexpr const char *const pge_northward_wind
Definition: VariableNames.h:61
ufo::ProfileCheckValidator
Profile QC check validator.
Definition: ProfileCheckValidator.h:27
ufo_radiancerttov_utils_mod::debug
logical, public debug
Definition: ufo_radiancerttov_utils_mod.F90:100
ufo::VariableNames::qcflags_eastward_wind
static constexpr const char *const qcflags_eastward_wind
Definition: VariableNames.h:95
ufo::ProfileConsistencyCheckParameters::PGEParameters
ProbabilityOfGrossErrorParameters PGEParameters
Parameters related to PGE calculations.
Definition: ProfileConsistencyCheckParameters.h:329
ufo::VariableNames::bkgerr_northward_wind
static constexpr const char *const bkgerr_northward_wind
Definition: VariableNames.h:50
ufo::BayesianPGEUpdate
void BayesianPGEUpdate(const ProbabilityOfGrossErrorParameters &options, const std::vector< float > &obsVal, const std::vector< float > &obsErr, const std::vector< float > &bkgVal, const std::vector< float > &bkgErr, const std::vector< float > &PdBad, const bool ModelLevels, std::vector< int > &flags, std::vector< float > &PGE, std::vector< float > &PGEBd, float ErrVarMax, const std::vector< float > *obsVal2, const std::vector< float > *bkgVal2)
Bayesian update of probability of gross error (PGE) for scalar (1D) or vector (2D) observables....
Definition: ProbabilityOfGrossError.cc:11
ufo::VariableNames::obserr_eastward_wind
static constexpr const char *const obserr_eastward_wind
Definition: VariableNames.h:30
ufo::VariableNames::obserr_northward_wind
static constexpr const char *const obserr_northward_wind
Definition: VariableNames.h:31
ufo
Definition: RunCRTM.h:27
ufo::ProfileConsistencyCheckParameters::modellevels
oops::Parameter< bool > modellevels
Have the observation and model values been averaged onto model levels?
Definition: ProfileConsistencyCheckParameters.h:54
ufo::ProfileCheckBase
Profile QC checker base class.
Definition: ProfileCheckBase.h:40
ufo::ProfileCheckBase::options_
const ProfileConsistencyCheckParameters & options_
Configurable parameters.
Definition: ProfileCheckBase.h:71
ProfileCheckBackgroundWindSpeed.h
ufo::VariableNames::hofx_northward_wind
static constexpr const char *const hofx_northward_wind
Definition: VariableNames.h:42
ufo::VariableNames::hofx_eastward_wind
static constexpr const char *const hofx_eastward_wind
Definition: VariableNames.h:41
ufo::VariableNames::qcflags_time
static constexpr const char *const qcflags_time
Definition: VariableNames.h:97
ufo::VariableNames::bkgerr_eastward_wind
static constexpr const char *const bkgerr_eastward_wind
Definition: VariableNames.h:49
ufo::ProfileConsistencyCheckParameters
Options controlling the operation of the ProfileConsistencyChecks filter.
Definition: ProfileConsistencyCheckParameters.h:33
ufo::VariableNames::obs_eastward_wind
static constexpr const char *const obs_eastward_wind
Definition: VariableNames.h:21
ufo::VariableNames::pge_eastward_wind
static constexpr const char *const pge_eastward_wind
Definition: VariableNames.h:60
ufo::ProfileCheckBackgroundWindSpeed::runCheck
void runCheck() override
Run check.
Definition: ProfileCheckBackgroundWindSpeed.cc:23
ufo::VariableNames::pgebd_northward_wind
static constexpr const char *const pgebd_northward_wind
Definition: VariableNames.h:73
ufo::MetOfficeQCFlags::InterpolationFlag
@ InterpolationFlag
Interpolation check flag.
Definition: MetOfficeQCFlags.h:87
ufo::ProfileDataHandler::get
std::vector< T > & get(const std::string &fullname)
Definition: ProfileDataHandler.h:53
ufo::VariableNames::pgebd_eastward_wind
static constexpr const char *const pgebd_eastward_wind
Definition: VariableNames.h:71