11 #include "ioda/ObsSpace.h"
18 const oops::Variables &simulatedVariables,
19 oops::Variables &operatorVariables,
20 std::vector<int> &operatorVariableIndices) {
21 if (conf.has(
"variables")) {
25 std::map<std::string, int> simulatedVariableIndices;
26 for (
int i = 0; i < simulatedVariables.size(); ++i)
27 simulatedVariableIndices[simulatedVariables[i]] = i;
29 for (
int i = 0; i < operatorVariables.size(); ++i) {
30 auto it = simulatedVariableIndices.find(operatorVariables[i]);
31 if (it == simulatedVariableIndices.end())
32 throw eckit::BadValue(
"Operator variable '" + operatorVariables[i] +
33 "' isn't one of the simulated variables", Here());
34 operatorVariableIndices.push_back(it->second);
37 operatorVariables = simulatedVariables;
38 operatorVariableIndices.resize(operatorVariables.size());
39 std::iota(operatorVariableIndices.begin(), operatorVariableIndices.end(), 0);
oops::Variables toOopsVariables() const
void getOperatorVariables(const eckit::Configuration &conf, const oops::Variables &simulatedVariables, oops::Variables &operatorVariables, std::vector< int > &operatorVariableIndices)