10 #include "ioda/ObsSpace.h"
12 #include "oops/util/missingValues.h"
14 #include "ufo/GeoVaLs.h"
21 const std::vector<std::size_t> & locs,
22 const std::string & modelVerticalCoord,
27 std::vector<float> pressure_obs(odb.nlocs());
28 odb.get_db(
"MetaData",
"air_pressure", pressure_obs);
33 if (!gv.
has(modelVerticalCoord))
return {};
35 const std::size_t nlevs_p = gv.
nlevs(modelVerticalCoord);
38 std::vector<std::size_t> slant_path_location(nlevs_p, locs.front());
40 std::vector <float> pressure_gv(nlevs_p);
44 std::size_t idxstart = 0;
47 std::size_t jlocslant = locs.front();
49 for (std::size_t mlev = 0; mlev < nlevs_p; ++mlev) {
50 for (
int iter = 0; iter <= itermax; ++iter) {
55 std::size_t jlociter = jlocslant;
59 for (std::size_t idx = idxstart; idx < locs.size(); ++idx) {
61 const std::size_t jlocintersect = locs[idx];
63 if (pressure_obs[jlocintersect] ==
missing)
continue;
66 if (pressure_obs[jlocintersect] <= pressure_gv[mlev])
break;
68 jlociter = jlocintersect;
70 if (iter == itermax) idxstart = idx;
74 if (iter == itermax) {
77 for (std::size_t mlevcolumn = mlev; mlevcolumn < nlevs_p; ++mlevcolumn)
78 slant_path_location[mlevcolumn] = jlocslant;
83 return slant_path_location;
GeoVaLs: geophysical values at locations.
size_t nlevs(const std::string &var) const
Return number of levels for a specified variable.
bool has(const std::string &var) const
void getAtLocation(std::vector< double > &, const std::string &, const int) const
Get GeoVaLs at a specified location.
std::vector< std::size_t > getSlantPathLocations(const ioda::ObsSpace &odb, const GeoVaLs &gv, const std::vector< std::size_t > &locs, const std::string &modelVerticalCoord, const int itermax)