UFO
VariableTransforms.cc
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2020, Met Office
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 
8 #include <algorithm>
9 #include <cmath>
10 #include <cstring>
11 #include <iomanip>
12 #include <limits>
13 #include <vector>
14 
15 #include "eckit/config/Configuration.h"
16 
17 #include "ioda/ObsDataVector.h"
18 #include "ioda/ObsSpace.h"
19 
20 #include "oops/util/abor1_cpp.h"
21 #include "oops/util/Logger.h"
22 
26 
27 namespace ufo {
28 
29 // -----------------------------------------------------------------------------
30 
32  ioda::ObsSpace& obsdb, const eckit::Configuration& config,
33  std::shared_ptr<ioda::ObsDataVector<int>> flags,
34  std::shared_ptr<ioda::ObsDataVector<float>> obserr)
35  : FilterBase(obsdb, config, flags, obserr)
36 {
38  options_->deserialize(config);
40 
41  // Add any required geovals to allvars_
42  for (const auto& cal_ : options_->Transform.value()) {
43  std::unique_ptr<TransformBase> Transform =
45  Variables gvars = Transform->requiredVariables();
46  allvars_ += Variables(gvars);
47  }
48 
49  oops::Log::debug() << "VariableTransforms: config = " << config << std::endl;
50 }
51 
52 // -----------------------------------------------------------------------------
53 
55 
56 // -----------------------------------------------------------------------------
57 
59  const std::vector<bool>& apply, const Variables& filtervars,
60  std::vector<std::vector<bool>>& flagged) const {
61  print(oops::Log::trace());
62  std::cout << " --> In variabletransforms::applyFilter" << std::endl;
63  std::cout << " --> set Transform object" << std::endl;
64 
65  // Run all calculations requested
66  for (const auto& cal_ : options_->Transform.value()) {
67  oops::Log::debug() << " estimate: " << cal_ << std::endl;
68  std::unique_ptr<TransformBase> Transform =
70  Transform->runTransform(apply);
71  }
72 }
73 
74 // -----------------------------------------------------------------------------
75 
76 void VariableTransforms::print(std::ostream& os) const {
77  os << "VariableTransforms: config = " << config_ << std::endl;
78 }
79 // -----------------------------------------------------------------------------
80 
81 } // namespace ufo
Base class for UFO QC filters.
Definition: FilterBase.h:45
const eckit::LocalConfiguration config_
Definition: FilterBase.h:59
ufo::Variables filtervars_
Definition: FilterBase.h:60
ufo::Variables allvars_
std::shared_ptr< ioda::ObsDataVector< int > > flags_
static std::unique_ptr< TransformBase > create(const std::string &, const VariableTransformsParameters &, const ObsFilterData &, const std::shared_ptr< ioda::ObsDataVector< int >> &)
std::unique_ptr< VariableTransformsParameters > options_
Configurable options.
VariableTransforms(ioda::ObsSpace &, const eckit::Configuration &, std::shared_ptr< ioda::ObsDataVector< int >>, std::shared_ptr< ioda::ObsDataVector< float >>)
void applyFilter(const std::vector< bool > &, const Variables &, std::vector< std::vector< bool >> &) const override
void print(std::ostream &) const override
Options controlling the operation of the variablestansform filter.
Definition: RunCRTM.h:27