This class provides access to observations that may be held on multiple MPI ranks.
More...
|
| ~ObsAccessor ()=default |
|
| ObsAccessor (const ObsAccessor &)=delete |
|
| ObsAccessor (ObsAccessor &&)=default |
|
ObsAccessor & | operator= (const ObsAccessor &)=delete |
|
ObsAccessor & | operator= (ObsAccessor &&)=default |
|
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. More...
|
|
std::vector< size_t > | getValidObservationIds (const std::vector< bool > &apply) const |
| Return the IDs of both flagged and unflagged observation locations selected by the where clause. More...
|
|
std::vector< int > | getIntVariableFromObsSpace (const std::string &group, const std::string &variable) const |
| Return the values of the specified variable at successive observation locations. More...
|
|
std::vector< float > | getFloatVariableFromObsSpace (const std::string &group, const std::string &variable) const |
|
std::vector< double > | getDoubleVariableFromObsSpace (const std::string &group, const std::string &variable) const |
|
std::vector< std::string > | getStringVariableFromObsSpace (const std::string &group, const std::string &variable) const |
|
std::vector< util::DateTime > | getDateTimeVariableFromObsSpace (const std::string &group, const std::string &variable) const |
|
std::vector< size_t > | getRecordIds () const |
| Return the vector of IDs of records successive observation locations belong to. More...
|
|
size_t | totalNumObservations () const |
|
RecursiveSplitter | splitObservationsIntoIndependentGroups (const std::vector< size_t > &validObsIds, bool opsCompatibilityMode=false) 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. More...
|
|
This class provides access to observations that may be held on multiple MPI ranks.
It is used by filters that may be configured to
- process observations held on all MPI ranks as a single group
- process observations from each record (by definition, held on a single MPI rank) independently from all others
- process observations with each distinct value of a particular variable (held on a single MPI rank if this variable was used to group observations into records or on multiple MPI ranks if not) independently from all others.
Depending on which of these cases applies, create an ObservationAccessor object by calling the ObsAccessor::toAllObservations(), ObsAccessor::toObservationsSplitIntoIndependentGroupsByRecordId() or the ObsAccessor::toObservationsSplitIntoIndependentGroupsByVariable() static function. The ObsAccessor will then determine whether each independent group consists of observations held only on a single MPI rank. If so, methods such as getValidObservationIds() and getIntVariableFromObsSpace() will return vectors constructed from data held only on the current MPI rank (without any MPI communication); otherwise, these vectors will be constructed from data obtained from all MPI ranks.
Call splitObservationsIntoIndependentGroups() to construct a RecursiveSplitter object whose groups() method will return groups of observations that can be processed independently from each other (according to the criterion specified when the ObsAccessor was constructed).
Definition at line 56 of file ObsAccessor.h.
std::vector< int > ufo::ObsAccessor::getIntVariableFromObsSpace |
( |
const std::string & |
group, |
|
|
const std::string & |
variable |
|
) |
| const |
Return the values of the specified variable at successive observation locations.
If each independent group of observations is stored entirely on a single MPI rank, the returned vector contains values observed at locations held on the current rank only. Otherwise the vector is a concatenation of vectors obtained on all ranks.
Definition at line 139 of file ObsAccessor.cc.
std::vector< size_t > ufo::ObsAccessor::getValidObservationIds |
( |
const std::vector< bool > & |
apply | ) |
const |
Return the IDs of both flagged and unflagged observation locations selected by the where clause.
- Parameters
-
apply | Vector whose ith element is set to true if ith observation location held on the current MPI rank was selected by the where clause in the filter's configuration. |
An observation location is treated as valid if it has been selected by the where
clause.
If each independent group of observations is stored entirely on a single MPI rank, the returned vector contains local IDs of valid observation locations held on the current rank only. Otherwise the vector contains global IDs of valid locations held on all ranks, with IDs from 0 to nlocs(0) - 1 corresponding to locations held on rank 0, IDs from nlocs(0) to nlocs(0) + nlocs(1) - 1 corresponding to locations held on rank 1 and so on, where nlocs(i) denotes the number of locations held on ith rank.
Definition at line 125 of file ObsAccessor.cc.
std::vector< size_t > ufo::ObsAccessor::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.
- Parameters
-
apply | Vector whose ith element is set to true if ith observation location held on the current MPI rank was selected by the where clause in the filter's configuration. |
flags | An ObsDataVector holding the QC flags (set by any filters run previously) of observations held on the current MPI rank. |
filtervars | List of filter variables. |
validIfAnyFilterVariablePassedQC | Boolean switch to treat an observation as valid if any filter variable has not been rejected. By default this is true; if false, the observation is only treated as valid if all filter variables have passed QC. |
An observation location is treated as valid if (a) it has been selected by the where
clause and (b) its QC flag(s) for (some/all) filtered variable(s) are set to pass
(see below).
If each independent group of observations is stored entirely on a single MPI rank, the returned vector contains local IDs of valid observation locations held on the current rank only. Otherwise the vector contains global IDs of valid locations held on all ranks, with IDs from 0 to nlocs(0) - 1 corresponding to locations held on rank 0, IDs from nlocs(0) to nlocs(0) + nlocs(1) - 1 corresponding to locations held on rank 1 and so on, where nlocs(i) denotes the number of locations held on ith rank.
If there is more than one filtered variable, and their QC flags differ, there is a choice as to whether to treat observation locations as valid (i) where none of the filtered variables have so far been rejected, or (ii) where at least one of these variables has not yet been rejected. The latter choice (ii) is the default, configurable via the switch validIfAnyFilterVariablePassedQC
.
Definition at line 99 of file ObsAccessor.cc.