15 #include "ioda/ObsVector.h"
17 #include "oops/util/Logger.h"
20 #include "ufo/GeoVaLs.h"
32 oops::Log::trace() <<
"ObsCategoricalTLAD constructor starting" << std::endl;
34 data_.configure(odb, params);
36 oops::Log::trace() <<
"ObsCategoricalTLAD created." << std::endl;
42 oops::Log::trace() <<
"ObsCategoricalTLAD destructed" << std::endl;
49 oops::Log::trace() <<
"ObsCategoricalTLAD: setTrajectory entered" << std::endl;
52 for (
const auto& component :
data_.components())
53 component.second->setTrajectory(geovals, ydiags);
55 oops::Log::trace() <<
"ObsCategoricalTLAD: setTrajectory finished" << std::endl;
61 oops::Log::trace() <<
"ObsCategoricalTLAD: simulateObsTL entered" << std::endl;
66 std::map <std::string, ioda::ObsVector> ovecs;
68 for (
const auto& component :
data_.components()) {
69 ioda::ObsVector ovecTemp(ovec);
70 component.second->simulateObsTL(geovals, ovecTemp);
71 ovecs.insert({component.first, ovecTemp});
76 data_.fillHofX(ovecs, ovec);
78 oops::Log::trace() <<
"ObsCategoricalTLAD: simulateObsTL finished" << std::endl;
84 oops::Log::trace() <<
"ObsCategoricalTLAD: simulateObsAD entered" << std::endl;
89 std::map <std::string, GeoVaLs> gvals;
91 for (
const auto& component :
data_.components()) {
93 component.second->simulateObsAD(gvalTemp, ovec);
94 gvals.insert({component.first, gvalTemp});
101 const std::vector<std::string> &varnames = ovec.varnames().variables();
102 std::vector <double> vecgv;
103 for (
size_t jloc = 0; jloc < ovec.nlocs(); ++jloc) {
104 const auto &operName =
data_.locOperNames()[jloc];
105 const auto &gvaloper = gvals.at(operName);
107 for (
const auto& varname : varnames) {
108 vecgv.resize(gvaloper.nlevs(varname));
109 gvaloper.getAtLocation(vecgv, varname, jloc);
114 oops::Log::trace() <<
"ObsCategoricalTLAD: simulateObsAD finished" << std::endl;
GeoVaLs: geophysical values at locations.
void putAtLocation(const std::vector< double > &vals, const std::string &var, const int loc) const
Put GeoVaLs for double variable var at location loc.
Configuration options recognized by the Categorical operator.
~ObsCategoricalTLAD() override
ObsCategoricalTLAD(const ioda::ObsSpace &, const Parameters_ &)
void print(std::ostream &) const override
void simulateObsTL(const GeoVaLs &, ioda::ObsVector &) const override
void setTrajectory(const GeoVaLs &, ObsDiagnostics &) override
Obs Operator.
void simulateObsAD(GeoVaLs &, const ioda::ObsVector &) const override
ObsCategoricalData< LinearObsOperatorBase > data_
Data handler for the Categorical operator and TL/AD code.
static LinearObsOperatorMaker< ObsCategoricalTLAD > makerCategoricalTL_("Categorical")