8 #ifndef UFO_FILTERS_OBSACCESSOR_H_
9 #define UFO_FILTERS_OBSACCESSOR_H_
15 #include <boost/optional.hpp>
17 #include "ioda/ObsDataVector.h"
18 #include "oops/util/DateTime.h"
24 template <
typename DATATYPE>
class ObsDataVector;
30 class RecursiveSplitter;
68 const ioda::ObsSpace &obsdb);
73 const ioda::ObsSpace &obsdb);
78 const ioda::ObsSpace &obsdb,
const Variable &variable);
117 bool validIfAnyFilterVariablePassedQC =
true)
const;
143 const std::string &variable)
const;
145 const std::string &variable)
const;
147 const std::string &variable)
const;
149 const std::string &variable)
const;
151 const std::string &variable)
const;
174 const std::vector<size_t> &validObsIds,
bool opsCompatibilityMode =
false)
const;
187 std::vector<std::vector<bool> > &flagged)
const;
197 boost::optional<Variable> categoryVariable);
221 bool isValid(
const std::vector<ioda::ObsDataRow<int>> &flags,
size_t ObsId,
222 bool validIfAnyFilterVariablePassedQC)
const;
This class provides access to observations that may be held on multiple MPI ranks.
RecursiveSplitter splitObservationsIntoIndependentGroups(const std::vector< size_t > &validObsIds, bool opsCompatibilityMode=false) const
std::vector< std::string > getStringVariableFromObsSpace(const std::string &group, const std::string &variable) const
std::vector< size_t > getValidObservationIds(const std::vector< bool > &apply, const ioda::ObsDataVector< int > &flags, const Variables &filtervars, bool validIfAnyFilterVariablePassedQC=true) const
Return the IDs of observation locations that should be treated as valid by a filter.
ObsAccessor & operator=(ObsAccessor &&)=default
std::vector< int > getIntVariableFromObsSpace(const std::string &group, const std::string &variable) const
Return the values of the specified variable at successive observation locations.
static ObsAccessor toObservationsSplitIntoIndependentGroupsByRecordId(const ioda::ObsSpace &obsdb)
Create an accessor to the collection of observations held in obsdb, assuming that each record can be ...
ObsAccessor(ObsAccessor &&)=default
void groupObservationsByCategoryVariable(const std::vector< size_t > &validObsIds, RecursiveSplitter &splitter) const
const ioda::ObsSpace * obsdb_
static ObsAccessor toAllObservations(const ioda::ObsSpace &obsdb)
Create an accessor to observations from the observation space obsdb, assuming that the whole set of o...
boost::optional< Variable > categoryVariable_
std::vector< size_t > getRecordIds() const
Return the vector of IDs of records successive observation locations belong to.
static ObsAccessor toObservationsSplitIntoIndependentGroupsByVariable(const ioda::ObsSpace &obsdb, const Variable &variable)
Create an accessor to the collection of observations held in obsdb, assuming that observations with d...
std::vector< float > getFloatVariableFromObsSpace(const std::string &group, const std::string &variable) const
ObsAccessor(const ObsAccessor &)=delete
ObsAccessor & operator=(const ObsAccessor &)=delete
void groupObservationsByRecordNumber(const std::vector< size_t > &validObsIds, RecursiveSplitter &splitter) const
bool wereRecordsGroupedByCategoryVariable() const
std::vector< util::DateTime > getDateTimeVariableFromObsSpace(const std::string &group, const std::string &variable) const
void flagRejectedObservations(const std::vector< bool > &isRejected, std::vector< std::vector< bool > > &flagged) const
Update flags of observations held on the current MPI rank.
bool isValid(const std::vector< ioda::ObsDataRow< int >> &flags, size_t ObsId, bool validIfAnyFilterVariablePassedQC) const
Return true if filtered variable(s) have passed QC, otherwise false.
std::shared_ptr< const ioda::Distribution > obsDistribution_
std::vector< double > getDoubleVariableFromObsSpace(const std::string &group, const std::string &variable) const
size_t totalNumObservations() const
Partitions an array into groups of elements equivalent according to certain criteria.