22 static ProfileCheckMaker<ProfileAveragePressure>
31 std::vector <float> &logP)
34 std::transform(logP.begin(), logP.end(), logP.begin(),
35 [
this](
float PLev){return PLev > 0 ? std::log(PLev) : missingValueFloat;});
39 std::vector <float> &ExnerP)
42 std::transform(ExnerP.begin(), ExnerP.end(), ExnerP.begin(),
43 [
this](
float PLev){return PLev > 0 ?
44 std::pow(PLev / ufo::Constants::pref, ufo::Constants::rd_over_cp) :
50 std::vector <float> &bigPgaps)
53 const float GapSize = std::log(10.0f);
59 std::transform(bigPgaps.begin(), bigPgaps.end(), bigPgaps.begin(),
60 [
this, GapFactor, GapLogPDiffMin](
float PLev){return PLev > 0.0 ?
61 GapFactor / std::max(std::log(PLev) - std::log(100.0f), GapLogPDiffMin) :
70 std::vector <std::string> variableNamesFloat =
78 std::vector <std::string> variableNamesGeoVaLs =
83 variableNamesFloat.insert
84 (variableNamesFloat.end(),
85 {
"OPS_" + std::string(ufo::VariableNames::modellevels_logP_rho_derived),
86 "OPS_" + std::string(ufo::VariableNames::modellevels_logP_derived),
87 "OPS_" + std::string(ufo::VariableNames::modellevels_ExnerP_rho_derived),
88 "OPS_" + std::string(ufo::VariableNames::modellevels_ExnerP_derived)});
89 variableNamesGeoVaLs.insert
90 (variableNamesGeoVaLs.end(),
91 {ufo::VariableNames::geovals_logP_rho,
92 ufo::VariableNames::geovals_logP,
93 ufo::VariableNames::geovals_ExnerP_rho,
94 ufo::VariableNames::geovals_ExnerP});
97 std::vector <ProfileDataHolder> profiles =
104 variableNamesGeoVaLs,
109 const size_t halfnprofs = profileDataHandler.
getObsdb().nrecs() / 2;
110 for (
size_t jprof = 0; jprof < halfnprofs; ++jprof) {
111 oops::Log::debug() <<
" Profile " << (jprof + 1) <<
" / " << halfnprofs << std::endl;
112 auto& profileOriginal = profiles[jprof];
113 auto& profileExtended = profiles[jprof + halfnprofs];
119 for (
size_t jprof = 0; jprof < halfnprofs * 2; ++jprof)
136 const std::vector <float> &pressures =
138 const std::vector <int> &ObsType =
140 const std::vector <int> &ReportFlags =
143 if (!oops::allVectorsSameNonZeroSize(pressures, ObsType, ReportFlags)) {
144 std::stringstream errorMessage;
145 errorMessage <<
"At least one vector is the wrong size. "
146 <<
"Pressure transformation will not be performed." << std::endl;
147 errorMessage <<
"Vector sizes: "
148 << oops::listOfVectorSizes(pressures, ObsType, ReportFlags)
150 throw eckit::BadValue(errorMessage.str(), Here());
160 std::vector <float> geovals_ExnerP_rho
171 if (numProfileLevels > 1 &&
181 const std::vector <float> &geovals_pressure_rho =
183 logPressure(geovals_pressure_rho, geovals_logP_rho);
187 const std::vector <float> &geovals_pressure =
190 if (geovals_pressure.empty())
191 throw eckit::BadValue(
"geovals_pressure is empty", Here());
202 std::move(geovals_logP_rho));
204 std::move(geovals_logP));
206 std::move(geovals_ExnerP_rho));
208 std::move(geovals_ExnerP));
216 std::move(
profile.getGeoVaLVector
220 std::move(
profile.getGeoVaLVector
224 std::move(
profile.getGeoVaLVector
228 std::move(
profile.getGeoVaLVector
Options controlling the operation of the ConventionalProfileProcessing filter.
oops::Parameter< float > AvgP_WinProGapFactor
oops::Parameter< bool > compareWithOPS
Compare with OPS values?
DataHandlerParameters DHParameters
Parameters related to profile data handler.
oops::Parameter< float > AvgP_SondeGapFactor
oops::Parameter< float > AvgP_GapLogPDiffMin
ModelParameters ModParameters
Parameters related to the model.
size_t numModelLevels() const
Number of model theta levels.
size_t numModelLevels_rho() const
void ExnerPressure(const std::vector< float > &pressures, std::vector< float > &ExnerP)
Calculate Exner pressure.
void bigPressureGaps(const std::vector< float > &pressures, const int ObsType, std::vector< float > &bigPgaps)
Calculate big gap for each pressure.
void runCheckOnProfiles(ProfileDataHolder &profileOriginal, ProfileDataHolder &profileExtended)
ProfileAveragePressure(const ConventionalProfileProcessingParameters &options)
void logPressure(const std::vector< float > &pressures, std::vector< float > &logP)
Calculate log(pressure).
void fillValidationData(ProfileDataHolder &profileDataHolder)
Fill variables in validator.
void runCheck(ProfileDataHandler &profileDataHandler) override
Run check on all profiles.
Profile QC checker base class.
const float missingValueFloat
Missing value (float)
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).
@ FinalRejectReport
One of flags 1-6 set.
@ OutOfAreaReport
Outside analysis area/time.
static ProfileCheckMaker< ProfileAveragePressure > makerProfileAveragePressure_("AveragePressure")
static constexpr const char *const extended_obs_space
static constexpr const char *const qcflags_observation_report
static constexpr const char *const modellevels_ExnerP_derived
static constexpr const char *const geovals_ExnerP
static constexpr const char *const bigPgaps_derived
static constexpr const char *const modellevels_logP_derived
static constexpr const char *const LogP_derived
static constexpr const char *const modellevels_logP_rho_derived
static constexpr const char *const geovals_pressure
static constexpr const char *const modellevels_ExnerP_rho_derived
static constexpr const char *const geovals_logP
static constexpr const char *const ObsType
static constexpr const char *const obs_air_pressure
static constexpr const char *const geovals_pressure_rho
static constexpr const char *const geovals_ExnerP_rho
static constexpr const char *const geovals_logP_rho