UFO
DrawObsErrorFromFile.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2021 Met Office UK
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
9 
10 namespace ufo {
11 
12 namespace {
13 
14 eckit::LocalConfiguration makeConfigForDrawValueFromFile(const eckit::LocalConfiguration &config) {
15  eckit::LocalConfiguration newConfig(config);
16  newConfig.set("group", "ErrorVariance");
17  return newConfig;
18 }
19 
20 } // namespace
21 
22 static ObsFunctionMaker<DrawObsErrorFromFile> maker("DrawObsErrorFromFile");
23 
24 
25 DrawObsErrorFromFile::DrawObsErrorFromFile(const eckit::LocalConfiguration &config)
26  : drawValueFromFile_(makeConfigForDrawValueFromFile(config)) {
27 }
28 
30  ioda::ObsDataVector<float> & out) const {
31  const float missing = util::missingValue(missing);
32 
33  // Interpolate variances
34  drawValueFromFile_.compute(in, out);
35 
36  // Transform them into standard deviations
37  for (size_t ivar = 0; ivar < out.nvars(); ++ivar)
38  for (float &value : out[ivar])
39  if (value != missing)
40  value = std::sqrt(value);
41 }
42 
45 }
46 
47 } // namespace ufo
DrawObsErrorFromFile(const eckit::LocalConfiguration &)
void compute(const ObsFilterData &, ioda::ObsDataVector< float > &) const
compute the result of the function
DrawValueFromFile< float > drawValueFromFile_
const ufo::Variables & requiredVariables() const
geovals required to compute the function
const ufo::Variables & requiredVariables() const
geovals required to compute the function
void compute(const ObsFilterData &, ioda::ObsDataVector< T > &) const
compute the result of the function
ObsFilterData provides access to all data related to an ObsFilter.
constexpr int missing
Definition: QCflags.h:20
eckit::LocalConfiguration makeConfigForDrawValueFromFile(const eckit::LocalConfiguration &config)
Definition: RunCRTM.h:27
static ObsOperatorMaker< ObsBackgroundErrorIdentity > maker("BackgroundErrorIdentity")