8 #ifndef UFO_PREDICTORS_PREDICTORBASE_H_
9 #define UFO_PREDICTORS_PREDICTORBASE_H_
16 #include <boost/make_unique.hpp>
17 #include <boost/noncopyable.hpp>
19 #include "ioda/ObsVector.h"
21 #include "oops/base/Variables.h"
22 #include "oops/util/AssociativeContainers.h"
23 #include "oops/util/parameters/OptionalParameter.h"
24 #include "oops/util/parameters/Parameters.h"
25 #include "oops/util/parameters/RequiredParameter.h"
42 oops::RequiredParameter<std::string>
name{
"name",
this};
68 virtual void compute(
const ioda::ObsSpace &,
71 ioda::ObsVector &)
const = 0;
92 typedef std::vector<std::shared_ptr<PredictorBase>>
Predictors;
105 const oops::Variables &vars);
109 static std::unique_ptr<PredictorParametersBase>
createParameters(
const std::string &name);
127 const oops::Variables &) = 0;
131 static std::map < std::string, PredictorFactory * > &
getMakers() {
132 static std::map < std::string, PredictorFactory * > makers_;
144 const oops::Variables & vars)
override {
145 const auto &stronglyTypedParameters =
dynamic_cast<const Parameters_&
>(parameters);
146 return boost::make_unique<T>(stronglyTypedParameters, vars);
150 return boost::make_unique<Parameters_>();
GeoVaLs: geophysical values at locations.
std::string & name()
predictor name
std::string func_name_
predictor name
const std::string & name() const
virtual void compute(const ioda::ObsSpace &, const GeoVaLs &, const ObsDiagnostics &, ioda::ObsVector &) const =0
compute the predictor
oops::Variables vars_
variables that will be bias-corrected using this predictor
oops::Variables geovars_
required GeoVaLs
PredictorBase(const PredictorParametersBase &, const oops::Variables &)
const oops::Variables & requiredGeovars() const
geovars names required to compute the predictor
oops::Variables hdiags_
required ObsDiagnostics
virtual ~PredictorBase()=default
const oops::Variables & requiredHdiagnostics() const
hdiags names required to compute the predictor
static std::unique_ptr< PredictorBase > create(const PredictorParametersBase ¶meters, const oops::Variables &vars)
Create and return a new predictor.
PredictorFactory(const std::string &name)
Register a maker able to create predictors of type name.
static bool predictorExists(const std::string &name)
Return true if a maker has been registered for a predictor of type name.
virtual std::unique_ptr< PredictorParametersBase > makeParameters() const =0
virtual std::unique_ptr< PredictorBase > make(const PredictorParametersBase &, const oops::Variables &)=0
static std::vector< std::string > getMakerNames()
Return the names of all predictors that can be created by one of the registered makers.
virtual ~PredictorFactory()=default
static std::map< std::string, PredictorFactory * > & getMakers()
static std::unique_ptr< PredictorParametersBase > createParameters(const std::string &name)
Create and return an instance of the subclass of PredictorParametersBase storing parameters of predic...
T::Parameters_ Parameters_
std::unique_ptr< PredictorBase > make(const PredictorParametersBase ¶meters, const oops::Variables &vars) override
std::unique_ptr< PredictorParametersBase > makeParameters() const override
PredictorMaker(const std::string &name)
Base class for predictor parameters.
oops::RequiredParameter< std::string > name
Predictor name.
std::vector< std::shared_ptr< PredictorBase > > Predictors