10 #include "eckit/exception/Exceptions.h"
12 #include "ioda/ObsDataVector.h"
14 #include "oops/util/Logger.h"
15 #include "oops/util/missingValues.h"
31 ASSERT(numerator.
size() == 1);
32 ASSERT(denominator.
size() == 1);
38 << config << std::endl;
55 <<
" and group: " << numerator.
group() << std::endl
56 <<
" denominator name: " << denominator.
variable()
57 <<
" and group: " << denominator.
group() << std::endl;
61 data.
get(numerator, numer);
63 data.
get(denominator, denom);
67 if (numer[iv].size() != out[iv].size() || numer[iv].size() != denom[iv].size()) {
68 std::ostringstream errString;
69 errString <<
"Something is wrong, numer size not equal out or denom size."
70 <<
" Sizes: " << numer[iv].size() <<
" and " << out[iv].size() << std::endl;
71 oops::Log::error() << errString.str();
72 throw eckit::BadValue(errString.str());
75 for (
size_t jobs = 0; jobs < numer[iv].size(); ++jobs) {
77 if (numer[iv][jobs] ==
missing || denom[iv][jobs] ==
missing || denom[iv][jobs] == 0) {
80 out[iv][jobs] = numer[iv][jobs]/denom[iv][jobs];
84 out.save(
"DerivedValue");
const ufo::Variables & requiredVariables() const
geovals required to compute the function
ObsErrorFactorQuotient(const eckit::LocalConfiguration)
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
ObsErrorFactorQuotientParameters options_
~ObsErrorFactorQuotient()
oops::Parameter< bool > save
oops::RequiredParameter< Variable > denominator
oops::RequiredParameter< Variable > numerator
the name of the numerator and denominator variables (with group names).
ObsFilterData provides access to all data related to an ObsFilter.
ioda::ObsSpace & obsspace() const
Returns reference to ObsSpace associated with ObsFilterData.
void get(const Variable &varname, std::vector< float > &values) const
Fills a std::vector with values of the specified variable.
const std::string & variable() const
const std::string & group() const
oops::Variables toOopsVariables() const
static ObsFunctionMaker< ObsErrorFactorConventional > makerSteps_("ObsErrorFactorConventional")