UFO
MetOfficeBuddyCollectorV2.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2020 Met Office UK
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 
9 
11 
12 namespace ufo {
13 
15  const std::vector<float> &latitudes,
16  const std::vector<float> &longitudes,
17  const std::vector<int> &stationIds)
18  : MetOfficeBuddyCollector(options, latitudes, longitudes, stationIds)
19 {}
20 
23 
24  const bool sameStationId = (stationIds_[obsIdA_] == stationIds_[obsIdB]);
26  return;
27 
29  double deltaLatInRad, deltaLonInRad, distanceInKm;
30  calcDeltaLatLonAndDistanceTo(obsIdB, deltaLatInRad, deltaLonInRad, distanceInKm);
31 
32  if (distanceInKm <= options_.searchRadius) {
33  buddyPairs_.push_back(createBuddyPair(obsIdB, deltaLatInRad, deltaLonInRad, distanceInKm));
36  if (sameStationId)
38  }
39  }
40 }
41 
43  std::vector<MetOfficeBuddyPair> &buddyPairs) const {
44  buddyPairs.insert(buddyPairs.end(), buddyPairs_.begin(), buddyPairs_.end());
45 }
46 
49  buddyPairs_.clear();
50 }
51 
52 
53 } // namespace ufo
Options controlling the operation of the MetOfficeBuddyCheck filter.
oops::Parameter< float > searchRadius
Maximum distance between two observations that may be classified as buddies, in km.
Interface of classes used by MetOfficeBuddyPairFinder to select observations used as buddies of other...
const std::vector< float > & latitudes_
const std::vector< int > & stationIds_
MetOfficeBuddyPair createBuddyPair(int obsIdB, double deltaLatInRad, double deltaLonInRad, double distanceInKm) const
virtual void reset(int obsIdA)=0
Prepare the object for examination of potential buddies of the observation with ID obsIdA.
const MetOfficeBuddyCheckParameters & options_
void calcDeltaLatLonAndDistanceTo(int obsIdB, double &deltaLatInRad, double &deltaLonInRad, double &distanceInKm) const
void reset(int obsIdA) override
Prepare the object for examination of potential buddies of the observation with ID obsIdA.
std::vector< MetOfficeBuddyPair > buddyPairs_
void appendBuddyPairsTo(std::vector< MetOfficeBuddyPair > &buddyPairs) const override
Extend buddyPairs with MetOfficeBuddyPair objects storing the properies of all buddy pairs found sinc...
MetOfficeBuddyCollectorV2(const MetOfficeBuddyCheckParameters &options, const std::vector< float > &latitudes, const std::vector< float > &longitudes, const std::vector< int > &stationIds)
void examinePotentialBuddy(int obsIdB) override
Check if the observation with ID obsIdB can be selected as a buddy of obsIdB. If so,...
Definition: RunCRTM.h:27
util::Duration abs(const util::Duration &duration)