UFO
ObsBiasParameters.h
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2021, 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 #ifndef UFO_OBSBIASPARAMETERS_H_
9 #define UFO_OBSBIASPARAMETERS_H_
10 
11 #include <string>
12 #include <vector>
13 
14 #include "oops/util/parameters/OptionalParameter.h"
15 #include "oops/util/parameters/Parameter.h"
16 #include "oops/util/parameters/Parameters.h"
17 #include "oops/util/parameters/RequiredParameter.h"
18 #include "oops/util/parameters/RequiredPolymorphicParameter.h"
19 
21 
22 namespace ufo {
23 
24 /// \brief Contains a polymorphic parameter holding an instance of a subclass of
25 /// PredictorParametersBase.
26 class PredictorParametersWrapper : public oops::Parameters {
27  OOPS_CONCRETE_PARAMETERS(PredictorParametersWrapper, Parameters)
28  public:
29  /// After deserialization, holds an instance of a subclass of PredictorParametersBase configuring
30  /// a predictor. The type of the subclass is determined by the value of the "name" key in the
31  /// Configuration object from which this object is deserialized.
32  oops::RequiredPolymorphicParameter<PredictorParametersBase, PredictorFactory>
33  predictorParameters{"name", this};
34 };
35 
36 class StaticOrVariationalBCParameters : public oops::Parameters {
37  OOPS_CONCRETE_PARAMETERS(StaticOrVariationalBCParameters, Parameters)
38 
39  public:
40  /// Each element of this list is used to configure a separate predictor.
41  oops::Parameter<std::vector<PredictorParametersWrapper>> predictors{"predictors", {}, this};
42 };
43 
44 class ObsBiasCovariancePriorInflationParameters : public oops::Parameters {
45  OOPS_CONCRETE_PARAMETERS(ObsBiasCovariancePriorInflationParameters, Parameters)
46 
47  public:
48  oops::RequiredParameter<double> ratio{"ratio", this};
49  oops::RequiredParameter<double> ratioForSmallDataset{"ratio for small dataset", this};
50 };
51 
52 class ObsBiasCovariancePriorParameters : public oops::Parameters {
53  OOPS_CONCRETE_PARAMETERS(ObsBiasCovariancePriorParameters, Parameters)
54 
55  public:
56  oops::RequiredParameter<ObsBiasCovariancePriorInflationParameters> inflation{"inflation", this};
57  oops::OptionalParameter<std::string> inputFile{"input file", this};
58 };
59 
60 class ObsBiasCovarianceParameters : public oops::Parameters {
61  OOPS_CONCRETE_PARAMETERS(ObsBiasCovarianceParameters, Parameters)
62 
63  public:
64  /// Default smallest variance value
65  static double defaultSmallestVariance() { return 1.0e-6; }
66  /// Default largest variance value
67  static double defaultLargestVariance() { return 10.0; }
68  /// Default largest analysis error variance
69  static double defaultLargestAnalysisVariance() { return 10000.0; }
70  /// Default step size
71  static double defaultStepSize() { return 1.e-4; }
72 
73  oops::RequiredParameter<size_t> minimalRequiredObsNumber{
74  "minimal required obs number", this};
75  oops::Parameter<std::vector<double>> varianceRange{
76  "variance range", {defaultSmallestVariance(), defaultLargestVariance()}, this};
77  oops::Parameter<double> stepSize{
78  "step size", defaultStepSize(), this};
79  oops::Parameter<double> largestAnalysisVariance{
80  "largest analysis variance", defaultLargestAnalysisVariance(), this};
81 
82  oops::OptionalParameter<ObsBiasCovariancePriorParameters> prior{
83  "prior", this};
84 };
85 
86 /// Parameters influencing the bias correction process.
87 class ObsBiasParameters : public oops::Parameters {
88  OOPS_CONCRETE_PARAMETERS(ObsBiasParameters, Parameters)
89 
90  public:
91  /// List of predictors with unit coefficients (unaffected by VarBC).
92  oops::Parameter<StaticOrVariationalBCParameters> staticBC{"static bc", {}, this};
93  /// List of predictors with coefficients determined by variational analysis (VarBC).
94  oops::Parameter<StaticOrVariationalBCParameters> variationalBC{"variational bc", {}, this};
95  /// Path to a NetCDF file containing initial values of the coefficients of predictors used
96  /// in VarBC.
97  oops::OptionalParameter<std::string> inputFile{"input file", this};
98  /// Path to a NetCDF file containing final values of the coefficients of predictors used
99  /// in VarBC.
100  oops::OptionalParameter<std::string> outputFile{"output file", this};
101  /// Options controlling the covariance matrix.
102  oops::OptionalParameter<ObsBiasCovarianceParameters> covariance{"covariance", this};
103 };
104 
105 } // namespace ufo
106 
107 #endif // UFO_OBSBIASPARAMETERS_H_
static double defaultStepSize()
Default step size.
static double defaultSmallestVariance()
Default smallest variance value.
oops::RequiredParameter< size_t > minimalRequiredObsNumber
oops::OptionalParameter< ObsBiasCovariancePriorParameters > prior
oops::Parameter< std::vector< double > > varianceRange
static double defaultLargestAnalysisVariance()
Default largest analysis error variance.
static double defaultLargestVariance()
Default largest variance value.
oops::Parameter< double > largestAnalysisVariance
oops::Parameter< double > stepSize
oops::RequiredParameter< double > ratioForSmallDataset
oops::RequiredParameter< double > ratio
oops::RequiredParameter< ObsBiasCovariancePriorInflationParameters > inflation
oops::OptionalParameter< std::string > inputFile
Parameters influencing the bias correction process.
oops::Parameter< StaticOrVariationalBCParameters > variationalBC
List of predictors with coefficients determined by variational analysis (VarBC).
oops::Parameter< StaticOrVariationalBCParameters > staticBC
List of predictors with unit coefficients (unaffected by VarBC).
oops::OptionalParameter< std::string > outputFile
oops::OptionalParameter< std::string > inputFile
oops::OptionalParameter< ObsBiasCovarianceParameters > covariance
Options controlling the covariance matrix.
Contains a polymorphic parameter holding an instance of a subclass of PredictorParametersBase.
oops::RequiredPolymorphicParameter< PredictorParametersBase, PredictorFactory > predictorParameters
oops::Parameter< std::vector< PredictorParametersWrapper > > predictors
Each element of this list is used to configure a separate predictor.
Definition: RunCRTM.h:27