UFO
ufo::TrackCheckShip Class Reference

Checks tracks of ships and buoys, rejecting observations whose locations and timestamps make them inconsistent with the rest of the track. More...

#include <TrackCheckShip.h>

Inheritance diagram for ufo::TrackCheckShip:
Collaboration diagram for ufo::TrackCheckShip:

Classes

struct  ObservationStatistics
 Relevant calculated values that are specific to each pair or triplet of adjacent/alternating observations. More...
 
class  TrackObservation
 
struct  TrackStatistics
 A container for all track-wise counters and calculations that indicate the overall quality of the tracks' data. More...
 

Public Member Functions

 TrackCheckShip (ioda::ObsSpace &obsdb, const eckit::Configuration &config, std::shared_ptr< ioda::ObsDataVector< int > > flags, std::shared_ptr< ioda::ObsDataVector< float > > obserr)
 
 ~TrackCheckShip () override
 
const TrackCheckShipDiagnosticsdiagnostics () const
 
- 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 ()
 
static double distance (const TrackObservation &a, const TrackObservation &b)
 Extends distance for TrackObservation inputs a and b. More...
 
static double speedEstimate (const TrackCheckShip::TrackObservation &obs1, const TrackCheckShip::TrackObservation &obs2, const TrackCheckShipParameters &options)
 Estimate of speed as calculated in Ops_CheckShipTrack. More...
 
static float angle (const TrackCheckShip::TrackObservation &a, const TrackCheckShip::TrackObservation &b, const TrackCheckShip::TrackObservation &c)
 Returns the angle in degrees (rounded to the nearest .1 degree) formed by the track segment going from observation a to b to c. More...
 

Private Types

enum  CalculationMethod { FIRSTITERATION, SIMULTANEOUSDEFERRAL, MAINLOOP }
 

Private Member Functions

void flagRejectedTrackObservations (std::vector< size_t >::const_iterator trackObsIndicesBegin, std::vector< size_t >::const_iterator trackObsIndicesEnd, const std::vector< size_t > &validObsIds, const std::vector< TrackObservation > &trackObservations, std::vector< bool > &isRejected) const
 
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
 
void calculateTrackSegmentProperties (const std::vector< std::reference_wrapper< TrackObservation >> &trackObservations, CalculationMethod calculationMethod=MAINLOOP) const
 
std::vector< TrackObservationcollectTrackObservations (std::vector< size_t >::const_iterator trackObsIndicesBegin, std::vector< size_t >::const_iterator trackObsIndicesEnd, const std::vector< size_t > &validObsIds, const TrackCheckUtils::ObsGroupLocationTimes &obsLoc) const
 
std::vector< std::reference_wrapper< TrackObservation > > removeSimultaneousObservations (const std::vector< std::reference_wrapper< TrackObservation >> &trackObs) const
 Filters out all observations that have been marked simultaneous for rechecking at the end. More...
 
bool earlyBreak (const std::vector< std::reference_wrapper< TrackObservation >> &trackObs) const
 
void removeFaultyObservation (std::vector< std::reference_wrapper< TrackObservation > > &track, const std::vector< std::reference_wrapper< TrackObservation > >::iterator &it, bool firstIterativeRemoval=false) const
 Chooses which of the observations surrounding the speediest segment to remove, flagging it accordingly. More...
 

Private Attributes

std::unique_ptr< TrackCheckShipParametersoptions_
 
std::unique_ptr< TrackCheckShipDiagnosticsdiagnostics_
 

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

Checks tracks of ships and buoys, rejecting observations whose locations and timestamps make them inconsistent with the rest of the track.

Each track is checked separately. The algorithm will first calculate speeds and distances between every two adjacent and alternating observations, and angles between any three adjacent observations. Based on these values, it will increment a set of "error counters" that reflect how many errors exist within the track. By default, if the "error counters" sum up to a value greater than or equal to half of the segments, the filter will be stopped.

Todo:
the implementation of the remainder of the filter is still in progress.

See TrackCheckShipsParameters for the documentation of this filter's parameters.

Definition at line 58 of file src/ufo/filters/TrackCheckShip.h.

Member Enumeration Documentation

◆ CalculationMethod

Enumerator
FIRSTITERATION 
SIMULTANEOUSDEFERRAL 
MAINLOOP 

Definition at line 214 of file src/ufo/filters/TrackCheckShip.h.

Constructor & Destructor Documentation

◆ TrackCheckShip()

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

Definition at line 36 of file TrackCheckShip.cc.

◆ ~TrackCheckShip()

ufo::TrackCheckShip::~TrackCheckShip ( )
override

Definition at line 111 of file TrackCheckShip.cc.

Member Function Documentation

◆ angle()

float ufo::TrackCheckShip::angle ( const TrackCheckShip::TrackObservation a,
const TrackCheckShip::TrackObservation b,
const TrackCheckShip::TrackObservation c 
)
static

Returns the angle in degrees (rounded to the nearest .1 degree) formed by the track segment going from observation a to b to c.

Definition at line 73 of file TrackCheckShip.cc.

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

◆ applyFilter()

void ufo::TrackCheckShip::applyFilter ( const std::vector< bool > &  apply,
const Variables filtervars,
std::vector< std::vector< bool >> &  flagged 
) const
overrideprivatevirtual
Todo:
This section is not yet fully implemented. Current implementation includes separating observations into tracks based on Station_Id, calculating distances, speeds, and angles between observations, and incrementing track-specific counters should the calculations produce unexpected values. Based on the counter values, the filter may be stopped early. Simultaneous observations are then optionally ignored for later re-inclusion or rejection. Using the above calculations and additional ones if necessary, the observation directly before and/or after the fastest segment is chosen for rejection. Re-checking of simultaneous observations is not yet implemented.

Implements ufo::FilterBase.

Definition at line 151 of file TrackCheckShip.cc.

Here is the call graph for this function:

◆ calculateTrackSegmentProperties()

void ufo::TrackCheckShip::calculateTrackSegmentProperties ( const std::vector< std::reference_wrapper< TrackObservation >> &  trackObservations,
CalculationMethod  calculationMethod = MAINLOOP 
) const
private

This performs all of the necessary calculations based on the observations' locations and timestamps by calling calculateTwoObservationValues and calculateThreeObservationValues for the non-edge-case observations.

Definition at line 567 of file TrackCheckShip.cc.

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

◆ classname()

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

Definition at line 61 of file src/ufo/filters/TrackCheckShip.h.

◆ collectTrackObservations()

std::vector< TrackCheckShip::TrackObservation > ufo::TrackCheckShip::collectTrackObservations ( std::vector< size_t >::const_iterator  trackObsIndicesBegin,
std::vector< size_t >::const_iterator  trackObsIndicesEnd,
const std::vector< size_t > &  validObsIds,
const TrackCheckUtils::ObsGroupLocationTimes obsLocTime 
) const
private
Returns
a vector of TrackObservations that all hold a shared_ptr to an instance of TrackStatistics, which holds all of the track-specific counters.

Definition at line 217 of file TrackCheckShip.cc.

Here is the caller graph for this function:

◆ diagnostics()

const TrackCheckShipDiagnostics * ufo::TrackCheckShip::diagnostics ( ) const

Definition at line 86 of file TrackCheckShip.cc.

Here is the caller graph for this function:

◆ distance()

static double ufo::TrackCheckShip::distance ( const TrackObservation a,
const TrackObservation b 
)
inlinestatic

Extends distance for TrackObservation inputs a and b.

Definition at line 184 of file src/ufo/filters/TrackCheckShip.h.

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

◆ earlyBreak()

bool ufo::TrackCheckShip::earlyBreak ( const std::vector< std::reference_wrapper< TrackObservation >> &  trackObs) const
private
Returns
true if at least half of the track segments have incremented the relevant rejection counters

This filter is best for mostly-accurate observation tracks. If the track has many "errors" (as indicated by the counters that are incremented before any observations are removed), it will stop early by default.

Definition at line 246 of file TrackCheckShip.cc.

Here is the caller graph for this function:

◆ flagRejectedTrackObservations()

void ufo::TrackCheckShip::flagRejectedTrackObservations ( std::vector< size_t >::const_iterator  trackObsIndicesBegin,
std::vector< size_t >::const_iterator  trackObsIndicesEnd,
const std::vector< size_t > &  validObsIds,
const std::vector< TrackObservation > &  trackObservations,
std::vector< bool > &  isRejected 
) const
private

Detects whether each observation in a track has been rejected, and marks the corresponding space in isRejected as true if so.

Parameters
trackObsIndicesBeginthe begin iterator of the track
trackObsIndicesEndthe end iterator
validObsIdsthe vector marking all of the observations' global positions
trackObservationsthe full vector of observations within the single track
isRejectedthe boolean vector whose indices correspond to all of the rejected observations in the full input dataset

Definition at line 124 of file TrackCheckShip.cc.

Here is the caller graph for this function:

◆ print()

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

Implements ufo::FilterBase.

Definition at line 137 of file TrackCheckShip.cc.

◆ qcFlag()

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

Implements ufo::FilterBase.

Definition at line 212 of file src/ufo/filters/TrackCheckShip.h.

◆ removeFaultyObservation()

void ufo::TrackCheckShip::removeFaultyObservation ( std::vector< std::reference_wrapper< TrackObservation > > &  track,
const std::vector< std::reference_wrapper< TrackObservation > >::iterator &  it,
bool  firstIterativeRemoval = false 
) const
private

Chooses which of the observations surrounding the speediest segment to remove, flagging it accordingly.

Definition at line 288 of file TrackCheckShip.cc.

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

◆ removeSimultaneousObservations()

std::vector< std::reference_wrapper< TrackCheckShip::TrackObservation > > ufo::TrackCheckShip::removeSimultaneousObservations ( const std::vector< std::reference_wrapper< TrackObservation >> &  trackObs) const
private

Filters out all observations that have been marked simultaneous for rechecking at the end.

Definition at line 276 of file TrackCheckShip.cc.

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

◆ speedEstimate()

double ufo::TrackCheckShip::speedEstimate ( const TrackCheckShip::TrackObservation obs1,
const TrackCheckShip::TrackObservation obs2,
const TrackCheckShipParameters options 
)
static

Estimate of speed as calculated in Ops_CheckShipTrack.

Speed is calculated between obs1 and obs2, accounting for spatial/temporal uncertainty using the resolution values stored in options.

Definition at line 53 of file TrackCheckShip.cc.

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

Member Data Documentation

◆ diagnostics_

std::unique_ptr<TrackCheckShipDiagnostics> ufo::TrackCheckShip::diagnostics_
private

Definition at line 200 of file src/ufo/filters/TrackCheckShip.h.

◆ options_

std::unique_ptr<TrackCheckShipParameters> ufo::TrackCheckShip::options_
private

Definition at line 199 of file src/ufo/filters/TrackCheckShip.h.


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