15 #include "ioda/ObsVector.h"
17 #include "oops/base/Variables.h"
18 #include "oops/util/Logger.h"
20 #include "ufo/GeoVaLs.h"
21 #include "ufo/Locations.h"
22 #include "ufo/ObsDiagnostics.h"
31 const eckit::Configuration & config)
34 oops::Log::trace() <<
"ObsProfileAverage constructed" << std::endl;
40 oops::Log::trace() <<
"ObsProfileAverage destructed" << std::endl;
47 oops::Log::trace() <<
"ObsProfileAverage: simulateObs started" << std::endl;
53 const std::vector<std::size_t> &recnums =
odb_.recidx_all_recnums();
56 const std::size_t nprofs = recnums.size() / 2;
59 for (std::size_t jprof = 0; jprof < nprofs; ++jprof) {
60 oops::Log::debug() <<
"Profile " << (jprof + 1) <<
" / " << nprofs << std::endl;
68 const std::vector<std::size_t> &locsOriginal =
odb_.recidx_vector(recnums[jprof]);
69 const std::vector<std::size_t> &locsExtended =
odb_.recidx_vector(recnums[jprof + nprofs]);
72 const std::vector<std::size_t>& slant_path_location =
77 const auto& variable = ovec.varnames().variables()[jvar];
79 const std::size_t nlevs_var = gv.
nlevs(variable);
81 std::vector<double> var_gv(nlevs_var);
86 for (std::size_t mlev = 0; mlev < nlevs_var; ++mlev) {
87 const std::size_t jloc = slant_path_location[mlev];
89 ovec[locsExtended[mlev] * ovec.nvars() + jvar] = var_gv[mlev];
94 oops::Log::trace() <<
"ObsProfileAverage: simulateObs finished" << std::endl;
GeoVaLs: geophysical values at locations.
size_t nlevs(const std::string &var) const
Return number of levels for a specified variable.
void getAtLocation(std::vector< double > &, const std::string &, const int) const
Get GeoVaLs at a specified location.
std::vector< std::size_t > getSlantPathLocations(const std::vector< std::size_t > &locsOriginal, const std::vector< std::size_t > &locsExtended) const
void cacheGeoVaLs(const GeoVaLs &gv) const
Cache the initial values of the GeoVaLs.
const std::vector< int > & operatorVarIndices() const
Return operator variable indices for the operator.
void print(std::ostream &os) const
Print operator configuration options.
ObsProfileAverageData data_
Data handler for the ProfileAverage operator and TL/AD code.
void simulateObs(const GeoVaLs &, ioda::ObsVector &, ObsDiagnostics &) const override
Obs Operator.
void print(std::ostream &) const override
~ObsProfileAverage() override
ObsProfileAverage(const ioda::ObsSpace &, const eckit::Configuration &)
const ioda::ObsSpace & odb_
ObsSpace.
static ObsOperatorMaker< ObsProfileAverage > obsProfileAverageMaker_("ProfileAverage")