UFO
ufo::MetOfficeBuddyCheck Class Reference

Met Office's implementation of the buddy check. More...

#include <MetOfficeBuddyCheck.h>

Inheritance diagram for ufo::MetOfficeBuddyCheck:
Collaboration diagram for ufo::MetOfficeBuddyCheck:

Classes

struct  MetaData
 Metadata of all observations processed by the filter. More...
 

Public Member Functions

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

Static Public Member Functions

static const std::string classname ()
 

Private Member Functions

void print (std::ostream &) const override
 
void applyFilter (const std::vector< bool > &, const Variables &, std::vector< std::vector< bool >> &) const override
 
int qcFlag () const override
 
std::vector< size_t > getValidObservationIds (const std::vector< bool > &apply) const
 Returns a vector of IDs of all observations that should be buddy-checked. More...
 
MetaData collectMetaData () const
 Collects and return smetadata of all observations. More...
 
std::vector< int > getStationIds () const
 Returns a vector of integer-valued station IDs, obtained from the source indicated by the filter parameters. More...
 
std::vector< float > calcBackgroundErrorHorizontalCorrelationScales (const std::vector< size_t > &validObsIds, const std::vector< float > &latitudes) const
 Calculates and returns background error correlation scales at observation locations. More...
 
std::vector< bool > flagAndPrintVerboseObservations (const std::vector< size_t > &validObsIds, const std::vector< float > &latitudes, const std::vector< float > &longitudes, const std::vector< util::DateTime > &times, const std::vector< float > *pressures, const std::vector< int > &stationIds, const std::vector< float > &bgErrorHorizCorrScales) const
 Identifies observations whose buddy checks should be logged. More...
 
void checkScalarSurfaceData (const std::vector< MetOfficeBuddyPair > &pairs, const std::vector< int > &flags, const std::vector< bool > &verbose, const std::vector< float > &bgErrorHorizCorrScales, const std::vector< int > &stationIds, const std::vector< util::DateTime > &datetimes, const std::vector< float > &obsValues, const std::vector< float > &obsBiases, const std::vector< float > &obsErrors, const std::vector< float > &bgValues, const std::vector< float > &bgErrors, std::vector< float > &pges) const
 Buddy check for scalar surface quantities. More...
 
void checkVectorSurfaceData (const std::vector< MetOfficeBuddyPair > &pairs, const std::vector< int > &flags, const std::vector< bool > &verbose, const std::vector< float > &bgErrorHorizCorrScales, const std::vector< int > &stationIds, const std::vector< util::DateTime > &datetimes, const std::vector< float > &uObsValues, const std::vector< float > &uObsBiases, const std::vector< float > &vObsValues, const std::vector< float > &vObsBiases, const std::vector< float > &obsErrors, const std::vector< float > &uBgValues, const std::vector< float > &vBgValues, const std::vector< float > &bgErrors, std::vector< float > &pges) const
 Buddy check for vector (two-dimensional) surface quantities. More...
 
void flagRejectedObservations (const Variables &filtervars, const std::map< std::string, std::vector< float >> &grossErrProbsByVarName, std::vector< std::vector< bool >> &flagged) const
 

Private Attributes

std::unique_ptr< MetOfficeBuddyCheckParametersoptions_
 

Additional Inherited Members

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

Detailed Description

Met Office's implementation of the buddy check.

The filter cross-checks observations taken at nearby locations against each other, updating their gross error probabilities (PGEs) and rejecting observations whose PGE exceeds a threshold specified in the filter parameters.

Variables to be checked should be specified using the "filter variables" YAML option. Currently only surface (single-level) variables are supported. Variables can be either scalar or vector (with two Cartesian components, such as the eastward and northward wind components). In the latter case the two components need to specified one after the other in the "filter variables" list, with the first component having the first_component_of_two option set to true. Example:

filter variables:
- name: air_temperature
- name: eastward_wind
options:
first_component_of_two: true
- name: northward_wind

See MetOfficeBuddyCheckParameters for the documentation of the other available parameters.

Definition at line 66 of file src/ufo/filters/MetOfficeBuddyCheck.h.

Constructor & Destructor Documentation

◆ MetOfficeBuddyCheck()

ufo::MetOfficeBuddyCheck::MetOfficeBuddyCheck ( ioda::ObsSpace &  obsdb,
const eckit::Configuration &  config,
std::shared_ptr< ioda::ObsDataVector< int > >  flags,
std::shared_ptr< ioda::ObsDataVector< float > >  obserr 
)

Definition at line 98 of file MetOfficeBuddyCheck.cc.

◆ ~MetOfficeBuddyCheck()

ufo::MetOfficeBuddyCheck::~MetOfficeBuddyCheck ( )
override

Definition at line 112 of file MetOfficeBuddyCheck.cc.

Member Function Documentation

◆ applyFilter()

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

Implements ufo::FilterBase.

Definition at line 115 of file MetOfficeBuddyCheck.cc.

Here is the call graph for this function:

◆ calcBackgroundErrorHorizontalCorrelationScales()

std::vector< float > ufo::MetOfficeBuddyCheck::calcBackgroundErrorHorizontalCorrelationScales ( const std::vector< size_t > &  validObsIds,
const std::vector< float > &  latitudes 
) const
private

Calculates and returns background error correlation scales at observation locations.

Only elements with indices corresponding to those of valid observations are filled in.

Definition at line 293 of file MetOfficeBuddyCheck.cc.

Here is the caller graph for this function:

◆ checkScalarSurfaceData()

void ufo::MetOfficeBuddyCheck::checkScalarSurfaceData ( const std::vector< MetOfficeBuddyPair > &  pairs,
const std::vector< int > &  flags,
const std::vector< bool > &  verbose,
const std::vector< float > &  bgErrorHorizCorrScales,
const std::vector< int > &  stationIds,
const std::vector< util::DateTime > &  datetimes,
const std::vector< float > &  obsValues,
const std::vector< float > &  obsBiases,
const std::vector< float > &  obsErrors,
const std::vector< float > &  bgValues,
const std::vector< float > &  bgErrors,
std::vector< float > &  pges 
) const
private

Buddy check for scalar surface quantities.

Method: see the OPS Scientific Documentation Paper 2, sections 3.6 and 3.7

Parameters
pairsBuddy pairs.
flagsObservation flags associated with the variable being checked.
verboseWhether to log buddy checks involving particular observations.
bgErrorHorizCorrScalesBackground error horizontal correlation scales (in km).
stationIdsStation IDs ("call signs").
datetimesObservation times.
obsValuesObserved values (excluding bias corrections).
obsBiasesBias corrections.
obsErrorsEstimated errors of observed values.
bgValuesBackground values.
bgErrorsEstimated errors of background values.
[in,out]pgesGross error probabilities. These values are updated by the buddy check.

Definition at line 351 of file MetOfficeBuddyCheck.cc.

Here is the caller graph for this function:

◆ checkVectorSurfaceData()

void ufo::MetOfficeBuddyCheck::checkVectorSurfaceData ( const std::vector< MetOfficeBuddyPair > &  pairs,
const std::vector< int > &  flags,
const std::vector< bool > &  verbose,
const std::vector< float > &  bgErrorHorizCorrScales,
const std::vector< int > &  stationIds,
const std::vector< util::DateTime > &  datetimes,
const std::vector< float > &  uObsValues,
const std::vector< float > &  uObsBiases,
const std::vector< float > &  vObsValues,
const std::vector< float > &  vObsBiases,
const std::vector< float > &  obsErrors,
const std::vector< float > &  uBgValues,
const std::vector< float > &  vBgValues,
const std::vector< float > &  bgErrors,
std::vector< float > &  pges 
) const
private

Buddy check for vector (two-dimensional) surface quantities.

Method: see the OPS Scientific Documentation Paper 2, sections 3.6 and 3.7

Parameters
pairsBuddy pairs.
flagsObservation flags associated with the variable being checked.
verboseWhether to log buddy checks involving particular observations.
bgErrorHorizCorrScalesBackground error horizontal correlation scales (in km).
stationIdsStation IDs ("call signs").
datetimesObservation times.
uObsValuesObserved values of the first component, u (excluding bias corrections).
uObsBiasesBias corrections for u.
vObsValuesObserved values of the second component, v (excluding bias corrections).
vObsBiasesBias corrections for v.
obsErrorsEstimated errors of observed values (u or v).
uBgValuesBackground values of u.
vBgValuesBackground values of v.
bgErrorsEstimated errors of background values (u or v).
[in,out]pgesProbabilities of gross error in u or v. These values are updated by the buddy check.

Definition at line 432 of file MetOfficeBuddyCheck.cc.

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

◆ classname()

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

Definition at line 69 of file src/ufo/filters/MetOfficeBuddyCheck.h.

◆ collectMetaData()

MetOfficeBuddyCheck::MetaData ufo::MetOfficeBuddyCheck::collectMetaData ( ) const
private

Collects and return smetadata of all observations.

Definition at line 237 of file MetOfficeBuddyCheck.cc.

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

◆ flagAndPrintVerboseObservations()

std::vector< bool > ufo::MetOfficeBuddyCheck::flagAndPrintVerboseObservations ( const std::vector< size_t > &  validObsIds,
const std::vector< float > &  latitudes,
const std::vector< float > &  longitudes,
const std::vector< util::DateTime > &  times,
const std::vector< float > *  pressures,
const std::vector< int > &  stationIds,
const std::vector< float > &  bgErrorHorizCorrScales 
) const
private

Identifies observations whose buddy checks should be logged.

This function identifies observations located in one of the boxes specified in the tracedBoxes option, prints the metadata of these observations and sets the corresponding elements of the returned vector to true. Functions performing buddy checks are expected to log buddy checks involving these observations.

Parameters
pressuresOptional – may be null.

Definition at line 313 of file MetOfficeBuddyCheck.cc.

Here is the caller graph for this function:

◆ flagRejectedObservations()

void ufo::MetOfficeBuddyCheck::flagRejectedObservations ( const Variables filtervars,
const std::map< std::string, std::vector< float >> &  grossErrProbsByVarName,
std::vector< std::vector< bool >> &  flagged 
) const
private

Marks observations whose gross error probability is >= options_->rejectionThreshold as rejected by the buddy check.

Definition at line 551 of file MetOfficeBuddyCheck.cc.

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

◆ getStationIds()

std::vector< int > ufo::MetOfficeBuddyCheck::getStationIds ( ) const
private

Returns a vector of integer-valued station IDs, obtained from the source indicated by the filter parameters.

Definition at line 259 of file MetOfficeBuddyCheck.cc.

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

◆ getValidObservationIds()

std::vector< size_t > ufo::MetOfficeBuddyCheck::getValidObservationIds ( const std::vector< bool > &  apply) const
private

Returns a vector of IDs of all observations that should be buddy-checked.

Definition at line 539 of file MetOfficeBuddyCheck.cc.

Here is the caller graph for this function:

◆ print()

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

Implements ufo::FilterBase.

Definition at line 569 of file MetOfficeBuddyCheck.cc.

◆ qcFlag()

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

Implements ufo::FilterBase.

Definition at line 83 of file src/ufo/filters/MetOfficeBuddyCheck.h.

Member Data Documentation

◆ options_

std::unique_ptr<MetOfficeBuddyCheckParameters> ufo::MetOfficeBuddyCheck::options_
private

Definition at line 217 of file src/ufo/filters/MetOfficeBuddyCheck.h.


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