UFO
ufo::BayesianBackgroundCheck Class Reference

BayesianBackgroundCheck: check observation closeness to background, accounting for probability of gross error, i.e. that observation is bad. More...

#include <BayesianBackgroundCheck.h>

Inheritance diagram for ufo::BayesianBackgroundCheck:
Collaboration diagram for ufo::BayesianBackgroundCheck:

Public Types

typedef BayesianBackgroundCheckParameters Parameters_
 

Public Member Functions

 BayesianBackgroundCheck (ioda::ObsSpace &obsdb, const Parameters_ &parameters, std::shared_ptr< ioda::ObsDataVector< int > > flags, std::shared_ptr< ioda::ObsDataVector< float > > obserr)
 
 ~BayesianBackgroundCheck ()
 
- Public Member Functions inherited from ufo::FilterBase
 FilterBase (ioda::ObsSpace &, const FilterParametersBaseWithAbstractAction &parameters, std::shared_ptr< ioda::ObsDataVector< int > >, std::shared_ptr< ioda::ObsDataVector< float > >)
 
 FilterBase (ioda::ObsSpace &, const eckit::Configuration &, std::shared_ptr< ioda::ObsDataVector< int > >, std::shared_ptr< ioda::ObsDataVector< float > >)
 
 ~FilterBase ()
 
- Public Member Functions inherited from ufo::ObsProcessorBase
 ObsProcessorBase (ioda::ObsSpace &, bool deferToPost, std::shared_ptr< ioda::ObsDataVector< int > >, std::shared_ptr< ioda::ObsDataVector< float > >)
 
 ~ObsProcessorBase ()
 
void preProcess () override
 
void priorFilter (const GeoVaLs &) override
 
void postFilter (const ioda::ObsVector &, const ioda::ObsVector &, const ObsDiagnostics &) override
 
oops::Variables requiredVars () const override
 
oops::Variables requiredHdiagnostics () const override
 

Static Public Member Functions

static const std::string classname ()
 

Private Member Functions

void print (std::ostream &) const override
 
void applyFilter (const std::vector< bool > &apply, const Variables &filtervars, std::vector< std::vector< bool >> &flagged) const override
 Apply Bayesian background check filter. Return flagged=true for rejected obs. More...
 
int qcFlag () const override
 Return bayesianQC flag for observations rejected by Bayesian BG check. More...
 
Variable backgrErrVariable (const Variable &filterVariable) const
 Return the name of the variable containing the background error estimate of the specified filter variable. More...
 
template<class T >
std::vector< T > reduceVector (const std::vector< T > &vector_full, const std::vector< size_t > &j_reduced) const
 Reduce a vector to only the elements for which j_reduced=true. More...
 
template<class T >
void unreduceVector (const std::vector< T > &vector_reduced, std::vector< T > &vector_full, const std::vector< size_t > &j_reduced) const
 Copy a reduced vector back into the correct indices of the full vector. More...
 

Private Attributes

Parameters_ parameters_
 

Additional Inherited Members

- Protected Attributes inherited from ufo::FilterBase
const eckit::LocalConfiguration config_
 
ufo::Variables filtervars_
 
- Protected Attributes inherited from ufo::ObsProcessorBase
ioda::ObsSpace & obsdb_
 
std::shared_ptr< ioda::ObsDataVector< int > > flags_
 
std::shared_ptr< ioda::ObsDataVector< float > > obserr_
 
ufo::Variables allvars_
 
ObsFilterData data_
 

Detailed Description

BayesianBackgroundCheck: check observation closeness to background, accounting for probability of gross error, i.e. that observation is bad.

Flag observations whose values differ from their model equivalents by too much. "Too much" depends on the uncertainties of both observation and model background, and the prior probability of the observation being "bad", or in gross error. Can apply to scalar or vector observation types on single-level. (Cannot handle profiles.) Calls function ufo::BayesianPGEUpdate.

Requires the following be specified in .yaml, under

obs filters:

  • filter: Bayesian Background Check
    • prob density bad obs: uniform probability density that observation is "bad", i.e. in gross error;
    • initial prob gross error: initial PGE value of the uniform probability distribution, before adjustment depending on obs-BG closeness;

May also specify the following optional parameters (defaults in ufo/utils/ProbabilityOfGrossErrorParameters.h):

  • PGE threshold: fail if after-check PGE exceeds this value;
  • obs minus BG threshold: fail if \(([y-H(x)]/{\sigma})^2\) exceeds this;
  • max exponent: maximum allowed value of the exponent in the 'good' probability distribution;
  • obs error multiplier: weight of observation error in combined error variance;
  • BG error multiplier: weight of background error in combined error variance.

Definition at line 75 of file BayesianBackgroundCheck.h.

Member Typedef Documentation

◆ Parameters_

The type of parameters accepted by the constructor of this filter. This typedef is used by the FilterFactory.

Definition at line 80 of file BayesianBackgroundCheck.h.

Constructor & Destructor Documentation

◆ BayesianBackgroundCheck()

ufo::BayesianBackgroundCheck::BayesianBackgroundCheck ( ioda::ObsSpace &  obsdb,
const Parameters_ parameters,
std::shared_ptr< ioda::ObsDataVector< int > >  flags,
std::shared_ptr< ioda::ObsDataVector< float > >  obserr 
)

BayesianBackgroundCheck: check observation closeness to background, accounting for probability of gross error, i.e. that observation is bad.

Definition at line 34 of file BayesianBackgroundCheck.cc.

Here is the call graph for this function:

◆ ~BayesianBackgroundCheck()

ufo::BayesianBackgroundCheck::~BayesianBackgroundCheck ( )

Definition at line 51 of file BayesianBackgroundCheck.cc.

Member Function Documentation

◆ applyFilter()

void ufo::BayesianBackgroundCheck::applyFilter ( const std::vector< bool > &  apply,
const Variables filtervars,
std::vector< std::vector< bool >> &  flagged 
) const
overrideprivatevirtual

Apply Bayesian background check filter. Return flagged=true for rejected obs.

Apply the Bayesian background check filter.

Implements ufo::FilterBase.

Definition at line 93 of file BayesianBackgroundCheck.cc.

Here is the call graph for this function:

◆ backgrErrVariable()

Variable ufo::BayesianBackgroundCheck::backgrErrVariable ( const Variable filterVariable) const
private

Return the name of the variable containing the background error estimate of the specified filter variable.

Return the name of the variable containing the background error estimate of the specified filter variable.

Definition at line 59 of file BayesianBackgroundCheck.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ classname()

static const std::string ufo::BayesianBackgroundCheck::classname ( )
inlinestatic

Definition at line 82 of file BayesianBackgroundCheck.h.

◆ print()

void ufo::BayesianBackgroundCheck::print ( std::ostream &  os) const
overrideprivatevirtual

Implements ufo::FilterBase.

Definition at line 266 of file BayesianBackgroundCheck.cc.

◆ qcFlag()

int ufo::BayesianBackgroundCheck::qcFlag ( ) const
inlineoverrideprivatevirtual

Return bayesianQC flag for observations rejected by Bayesian BG check.

Implements ufo::FilterBase.

Definition at line 97 of file BayesianBackgroundCheck.h.

◆ reduceVector()

template<class T >
std::vector< T > ufo::BayesianBackgroundCheck::reduceVector ( const std::vector< T > &  vector_full,
const std::vector< size_t > &  j_reduced 
) const
private

Reduce a vector to only the elements for which j_reduced=true.

Parameters
[in]vector_fullfull vector,
[in]j_reducedindices of vector_full to be copied into...
Returns
vector_reduced.

Definition at line 67 of file BayesianBackgroundCheck.cc.

Here is the caller graph for this function:

◆ unreduceVector()

template<class T >
void ufo::BayesianBackgroundCheck::unreduceVector ( const std::vector< T > &  vector_reduced,
std::vector< T > &  vector_full,
const std::vector< size_t > &  j_reduced 
) const
private

Copy a reduced vector back into the correct indices of the full vector.

Parameters
[in]vector_reducedreduced vector to restore to...
[in,out]vector_fullfull vector,
[in]j_reducedindices of vector_full to be populated.

Definition at line 81 of file BayesianBackgroundCheck.cc.

Here is the caller graph for this function:

Member Data Documentation

◆ parameters_

Parameters_ ufo::BayesianBackgroundCheck::parameters_
private

Definition at line 119 of file BayesianBackgroundCheck.h.


The documentation for this class was generated from the following files: