22 static ProfileCheckMaker<ProfileAverageWindSpeed>
35 std::vector <std::string> variableNamesInt =
44 std::vector <std::string> variableNamesFloat =
53 std::vector <std::string> variableNamesGeoVaLs =
57 variableNamesInt.insert
58 (variableNamesInt.end(),
60 std::string(ufo::VariableNames::modellevels_average_eastward_wind_qcflags),
62 std::string(ufo::VariableNames::modellevels_average_northward_wind_qcflags)});
63 variableNamesFloat.insert
64 (variableNamesFloat.end(),
66 std::string(ufo::VariableNames::modellevels_average_eastward_wind_derived),
68 std::string(ufo::VariableNames::modellevels_average_northward_wind_derived)});
69 variableNamesGeoVaLs.insert
70 (variableNamesGeoVaLs.end(),
71 {ufo::VariableNames::geovals_average_eastward_wind,
72 ufo::VariableNames::geovals_average_eastward_wind_qcflags,
73 ufo::VariableNames::geovals_average_northward_wind,
74 ufo::VariableNames::geovals_average_northward_wind_qcflags});
77 std::vector <ProfileDataHolder> profiles =
87 const size_t halfnprofs = profileDataHandler.
getObsdb().nrecs() / 2;
88 for (
size_t jprof = 0; jprof < halfnprofs; ++jprof) {
89 oops::Log::debug() <<
" Profile " << (jprof + 1) <<
" / " << halfnprofs << std::endl;
90 auto& profileOriginal = profiles[jprof];
91 auto& profileExtended = profiles[jprof + halfnprofs];
98 for (
size_t jprof = 0; jprof < halfnprofs * 2; ++jprof) {
117 if (numProfileLevels <= 1)
120 const std::vector <float> &uObs =
122 const std::vector <float> &vObs =
124 const std::vector <float> &uPGEBd =
126 std::vector <int> &uFlags =
128 std::vector <int> &vFlags =
130 std::vector <int> &NumGapsU =
133 std::vector <int> &NumGapsUWP =
135 const std::vector <int> &ObsType =
138 if (!oops::allVectorsSameNonZeroSize(uObs, vObs,
142 oops::Log::warning() <<
"At least one vector is the wrong size. "
143 <<
"Wind speed averaging will not be performed." << std::endl;
144 oops::Log::warning() <<
"Vector sizes: "
145 << oops::listOfVectorSizes(uObs, vObs,
156 std::vector <float> &geovals_surface_pressure =
158 if (geovals_surface_pressure.empty())
159 throw eckit::BadValue(
"Surface pressure GeoVaLs vector is empty.", Here());
162 const std::vector <float> &LogPB =
164 const std::vector <float> &RepLogP =
166 const std::vector <float> &BigGap =
170 !oops::allVectorsSameNonZeroSize(RepLogP, BigGap)) {
171 std::stringstream errorMessage;
172 errorMessage <<
"At least one model-level vector is the wrong size. "
173 <<
"Ensure that the AveragePressure routine has been run before this one."
175 errorMessage <<
"Vector sizes: "
176 << oops::listOfVectorSizes(LogPB,
179 throw eckit::BadValue(errorMessage.str(), Here());
184 std::vector <float> LogPWB = LogPB;
185 LogPWB.insert(LogPWB.begin(), std::log(geovals_surface_pressure[0]));
189 for (
size_t jlev = 0; jlev < numProfileLevels; ++jlev) {
198 std::vector <float> uModObs;
199 std::vector <int> uFlagsModObs;
222 std::vector <float> vModObs;
223 std::vector <int> vFlagsModObs;
236 profileExtended.
set<
float>
240 profileExtended.
set<
int>
244 profileExtended.
set<
float>
248 profileExtended.
set<
int>
259 std::move(
profile.getGeoVaLVector
263 std::move(
profile.getGeoVaLVector
268 const std::vector <float>& average_eastward_wind_qcflags_float =
271 std::vector <int> average_eastward_wind_qcflags_int
272 (average_eastward_wind_qcflags_float.begin(),
273 average_eastward_wind_qcflags_float.end());
274 std::replace(average_eastward_wind_qcflags_int.begin(),
275 average_eastward_wind_qcflags_int.end(),
280 std::move(average_eastward_wind_qcflags_int));
281 const std::vector <float>& average_northward_wind_qcflags_float =
284 std::vector <int> average_northward_wind_qcflags_int
285 (average_northward_wind_qcflags_float.begin(),
286 average_northward_wind_qcflags_float.end());
287 std::replace(average_northward_wind_qcflags_int.begin(),
288 average_northward_wind_qcflags_int.end(),
293 std::move(average_northward_wind_qcflags_int));
Options controlling the operation of the ConventionalProfileProcessing filter.
oops::Parameter< bool > compareWithOPS
Compare with OPS values?
oops::Parameter< float > AvgU_SondeDZFraction
oops::Parameter< float > AvgU_PGEskip
void runCheckOnProfiles(ProfileDataHolder &profileOriginal, ProfileDataHolder &profileExtended)
ProfileAverageWindSpeed(const ConventionalProfileProcessingParameters &options)
void runCheck(ProfileDataHandler &profileDataHandler) override
void fillValidationData(ProfileDataHolder &profileDataHolder)
Fill variables in validator (for comparison with OPS output).
Profile QC checker base class.
const ConventionalProfileProcessingParameters & options_
Configurable parameters.
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.
int getNumProfileLevels() const
Get number of profile levels for this profile.
std::vector< T > & get(const std::string &fullname)
Retrieve a vector if it is present. If not, throw an exception.
void set(const std::string &fullname, std::vector< T > &&vec_in)
Set values in a vector.
std::vector< float > & getGeoVaLVector(const std::string &fullname)
Retrieve a GeoVaL vector if it is present. If not, throw an exception.
void checkObsSpaceSection(ufo::ObsSpaceSection section)
Check this profile is in the expected ObsSpace section (original or extended).
@ FinalRejectFlag
Final QC flag.
void calculateVerticalAverage(const std::vector< int > &flagsIn, const std::vector< float > &valuesIn, const std::vector< float > &coordIn, const std::vector< float > &bigGap, const std::vector< float > &coordOut, float DZFrac, ProfileAveraging::Method method, std::vector< int > &flagsOut, std::vector< float > &valuesOut, int &numGaps, std::vector< float > *coordMax, std::vector< float > *coordMin)
Profile vertical averaging onto model levels.
static ProfileCheckMaker< ProfileAverageWindSpeed > makerProfileAverageWindSpeed_("AverageWindSpeed")
static constexpr const char *const extended_obs_space
static constexpr const char *const qcflags_eastward_wind
static constexpr const char *const counter_NumGapsU
static constexpr const char *const counter_NumGapsUWP
static constexpr const char *const bigPgaps_derived
static constexpr const char *const modellevels_average_eastward_wind_derived
static constexpr const char *const qcflags_northward_wind
static constexpr const char *const modellevels_logP_derived
static constexpr const char *const modellevels_average_eastward_wind_qcflags
static constexpr const char *const geovals_surface_pressure
static constexpr const char *const modellevels_average_northward_wind_qcflags
static constexpr const char *const geovals_average_eastward_wind
static constexpr const char *const geovals_average_northward_wind
static constexpr const char *const LogP_derived
static constexpr const char *const obs_northward_wind
static constexpr const char *const obs_eastward_wind
static constexpr const char *const geovals_average_northward_wind_qcflags
static constexpr const char *const ObsType
static constexpr const char *const pgebd_eastward_wind
static constexpr const char *const modellevels_average_northward_wind_derived
static constexpr const char *const geovals_average_eastward_wind_qcflags