16 static ProfileCheckMaker<ProfileCheckUInterpAlternative>
30 std::vector <std::string> variableNamesInt =
34 std::vector <std::string> variableNamesFloat =
39 variableNamesInt.insert(variableNamesInt.end(),
40 {ufo::VariableNames::StdLev,
41 ufo::VariableNames::SigAbove,
42 ufo::VariableNames::SigBelow,
43 ufo::VariableNames::LevErrors,
44 ufo::VariableNames::NumStd,
45 ufo::VariableNames::NumSig});
46 variableNamesFloat.insert(variableNamesFloat.end(),
47 {ufo::VariableNames::uInterp,
48 ufo::VariableNames::vInterp,
49 ufo::VariableNames::LogP});
52 std::vector <ProfileDataHolder> profiles =
61 const size_t nprofs = profileDataHandler.
getObsdb().nrecs();
62 for (
size_t jprof = 0; jprof < nprofs; ++jprof) {
63 oops::Log::debug() <<
"Profile " << (jprof + 1) <<
" / " << nprofs << std::endl;
64 auto&
profile = profiles[jprof];
78 const int numProfileLevels =
profile.getNumProfileLevels();
79 const std::vector <float> &pressures =
81 const std::vector <float> &uObs =
83 const std::vector <float> &vObs =
85 std::vector <int> &uFlags =
87 std::vector <int> &NumSamePErrObs =
89 std::vector <int> &NumInterpErrObs =
92 if (!oops::allVectorsSameNonZeroSize(pressures, uObs, vObs, uFlags)) {
93 oops::Log::warning() <<
"At least one vector is the wrong size. "
94 <<
"Check will not be performed." << std::endl;
95 oops::Log::warning() <<
"Vector sizes: "
96 << oops::listOfVectorSizes(pressures, uObs, vObs, uFlags)
104 uInterp_.assign(numProfileLevels, 0.0);
105 vInterp_.assign(numProfileLevels, 0.0);
111 for (
int jlev = 0; jlev < numProfileLevels; ++jlev) {
113 if (jlevprev != -1) {
114 if (pressures[jlev] == pressures[jlevprev] &&
115 (uObs[jlev] != uObs[jlevprev] || vObs[jlev] != vObs[jlevprev])) {
116 float VectDiffSq = std::pow(uObs[jlev] - uObs[jlevprev], 2) +
117 std::pow(vObs[jlev] - vObs[jlevprev], 2);
123 <<
"and significantly different wind speed magnitude for "
124 <<
"levels " << jlevprev <<
" and " << jlev << std::endl;
126 <<
"P = " << pressures[jlevprev] * 0.01 <<
"hPa, uObs = "
127 << uObs[jlevprev] <<
"ms^-1, vObs = "
128 << vObs[jlevprev] <<
"ms^-1" << std::endl;
130 <<
"P = " << pressures[jlev] * 0.01 <<
"hPa, uObs = "
131 << uObs[jlev] <<
"ms^-1, vObs = "
132 << vObs[jlev] <<
"ms^-1" << std::endl;
133 oops::Log::debug() <<
" -> VectDiffSq = " << VectDiffSq <<
"m^2s^-2" << std::endl;
141 if (NumErrors > 0) NumSamePErrObs[0]++;
147 for (
int jlevStd = 0; jlevStd <
NumStd_; ++jlevStd) {
152 float PStd = pressures[jlev];
157 for (
size_t bgidx = 0; bgidx < BigGapsPThresh.size(); ++bgidx) {
158 if (PStd > BigGapsPThresh[bgidx]) {
159 BigGap = BigGaps[bgidx];
164 if (pressures[SigB] - PStd > BigGap ||
165 PStd - pressures[SigA] > BigGap) {
174 uInterp_[jlev] = uObs[SigB] + (uObs[SigA] - uObs[SigB]) * Ratio;
175 vInterp_[jlev] = vObs[SigB] + (vObs[SigA] - vObs[SigB]) * Ratio;
178 float VectDiffSq = std::pow(uObs[jlev] -
uInterp_[jlev], 2) +
179 std::pow(vObs[jlev] -
vInterp_[jlev], 2);
190 oops::Log::debug() <<
" -> Failed wind speed interpolation check for levels " << jlev
191 <<
" (central), " << SigB <<
" (lower) and "
192 << SigA <<
" (upper)" << std::endl;
194 <<
"P = " << pressures[jlev] * 0.01 <<
"hPa, uObs = "
195 << uObs[jlev] <<
"ms^-1, vObs = "
196 << vObs[jlev] <<
"ms^-1, uInterp = " <<
uInterp_[jlev]
197 <<
"ms^-1, vInterp = " <<
vInterp_[jlev] <<
"ms^-1" << std::endl;
198 oops::Log::debug() <<
" -> VectDiffSq = " << VectDiffSq <<
"m^2s^-2" << std::endl;
202 if (NumErrors > 0) NumInterpErrObs[0]++;
214 std::vector <int> NumStd(
profile.getNumProfileLevels(), std::move(
NumStd_));
215 std::vector <int> NumSig(
profile.getNumProfileLevels(), std::move(
NumSig_));
Options controlling the operation of the ConventionalProfileProcessing filter.
oops::Parameter< bool > compareWithOPS
Compare with OPS values?
oops::Parameter< std::vector< float > > UICheck_BigGapsPThresh
oops::Parameter< float > UICheck_BigGapLowP
Big gap (Pa) used at lowest pressures in wind speed interpolation check.
oops::Parameter< float > UICheck_TInterpIdenticalPTolSq
Squared tolerance for identical pressure in wind speed interpolation check (m^2 s^-2)
oops::Parameter< float > UICheck_TInterpTolSq
Squared tolerance for wind speed interpolation check (m^2 s^-2)
oops::Parameter< std::vector< float > > UICheck_BigGaps
Profile QC checker base class.
const float missingValueFloat
Missing value (float)
const ConventionalProfileProcessingParameters & options_
Configurable parameters.
std::vector< float > uInterp_
Interpolated value of u.
void runCheckOnProfile(ProfileDataHolder &profile)
Run check on an individual profile.
void fillValidationData(ProfileDataHolder &profileDataHolder)
Fill variables in validator.
std::vector< float > vInterp_
Interpolated value of v.
std::vector< int > LevErrors_
Number of failed checks by level.
void runCheck(ProfileDataHandler &profileDataHandler) override
Run check on all profiles.
ProfileCheckUInterpAlternative(const ConventionalProfileProcessingParameters &options)
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
void updateAllProfiles(std::vector< ProfileDataHolder > &profiles)
Read values from a collection of profiles and update information related to each one.
std::vector< ProfileDataHolder > produceProfileVector(const std::vector< std::string > &variableNamesInt, const std::vector< std::string > &variableNamesFloat, const std::vector< std::string > &variableNamesString, const std::vector< std::string > &variableNamesGeoVaLs, const std::vector< std::string > &variableNamesObsDiags)
Produce a vector of all profiles, loading the requested variables into each one.
ioda::ObsSpace & getObsdb()
Return obsdb.
Profile data holder class.
Calculate standard levels.
void calcStdLevelsUV(const int numProfileLevels, const std::vector< float > &pressures, const std::vector< float > &uObs, const std::vector< float > &vObs, const std::vector< int > &uFlags)
Calculate standard levels for U and V data.
std::vector< int > StdLev_
Index of standard levels.
std::vector< float > LogP_
Log(Pressure) - used for vertical interpolation.
int NumStd_
Number of standard levels.
std::vector< int > SigBelow_
Significant level below standard level.
std::vector< int > SigAbove_
Significant level above standard level.
int NumSig_
Number of significant levels.
@ InterpolationFlag
Interpolation check flag.
static ProfileCheckMaker< ProfileCheckUInterpAlternative > makerProfileCheckUInterpAlternative_("UInterpAlternative")
static constexpr const char *const qcflags_eastward_wind
static constexpr const char *const LogP
static constexpr const char *const counter_NumSamePErrObs
static constexpr const char *const counter_NumInterpErrObs
static constexpr const char *const LevErrors
static constexpr const char *const uInterp
static constexpr const char *const NumSig
static constexpr const char *const obs_northward_wind
static constexpr const char *const NumStd
static constexpr const char *const obs_eastward_wind
static constexpr const char *const SigBelow
static constexpr const char *const StdLev
static constexpr const char *const vInterp
static constexpr const char *const obs_air_pressure
static constexpr const char *const SigAbove