UFO
ProbabilityOfGrossError.h
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 #ifndef UFO_UTILS_PROBABILITYOFGROSSERROR_H_
9 #define UFO_UTILS_PROBABILITYOFGROSSERROR_H_
10 
11 #include <algorithm>
12 #include <string>
13 #include <vector>
14 
15 #include "oops/util/missingValues.h"
16 
19 
20 namespace ufo {
21  /// \brief Bayesian update of probability of gross error (PGE)
22  /// \details Update PGE across locations according to (obsVal-bkgVal), obsErr, and bkgErr,
23  /// and update flags to say BG check performed, and whether obs rejected or not.
24  /// This routine can process both single observations and observations on profile levels.
25  /// In the vector case, the variance is assumed to be isotropic
26  /// and obsErr and bkgErr give the error in a single vector component.
27  ///
28  /// \param[in] options: Configurable parameters that govern the operation of this routine.
29  /// \param[in] obsVal: Observation values.
30  /// \param[in] obsErr: Observation errors.
31  /// \param[in] bkgVal: Background values.
32  /// \param[in] bkgErr: Background errors.
33  /// \param[in] PdBad: Probability density for 'bad' observations.
34  /// \param[in] ModelLevels: Have the data been averaged onto model levels?
35  /// \param[inout] flags: QC flags.
36  /// \param[inout] PGE: Probability of gross error.
37  /// \param[inout] PGEBd: PGE for input to buddy check.
38  /// \param[in] ErrVarMax: (Optional) Maximum error variance.
39  /// \param[in] obsVal2: (Optional) Second component of 2D observation values.
40  /// \param[in] bkgVal2: (Optional) Second component of 2D background values.
41 
42  void BayesianPGEUpdate(const ProbabilityOfGrossErrorParameters &options,
43  const std::vector<float> &obsVal,
44  const std::vector<float> &obsErr,
45  const std::vector<float> &bkgVal,
46  const std::vector<float> &bkgErr,
47  const std::vector<float> &PdBad,
48  const bool ModelLevels,
49  std::vector<int> &flags,
50  std::vector<float> &PGE,
51  std::vector<float> &PGEBd,
52  float ErrVarMax = -1,
53  const std::vector<float> *obsVal2 = nullptr,
54  const std::vector<float> *bkgVal2 = nullptr);
55 } // namespace ufo
56 
57 #endif // UFO_UTILS_PROBABILITYOFGROSSERROR_H_
Definition: RunCRTM.h:27
void BayesianPGEUpdate(const ProbabilityOfGrossErrorParameters &options, const std::vector< float > &obsVal, const std::vector< float > &obsErr, const std::vector< float > &bkgVal, const std::vector< float > &bkgErr, const std::vector< float > &PdBad, const bool ModelLevels, std::vector< int > &flags, std::vector< float > &PGE, std::vector< float > &PGEBd, float ErrVarMax, const std::vector< float > *obsVal2, const std::vector< float > *bkgVal2)
Bayesian update of probability of gross error (PGE)