UFO
ufo::ProfileDataHandler Class Reference

Retrieve and store data for individual profiles. To do this, first the vector of values in the entire data sample is retrieved then the relevant data corresponding to this profile are extracted. More...

#include <ProfileDataHandler.h>

Collaboration diagram for ufo::ProfileDataHandler:

Public Member Functions

 ProfileDataHandler (const ObsFilterData &data, const DataHandlerParameters &options, const std::vector< bool > &apply, const Variables &filtervars, std::vector< std::vector< bool >> &flagged)
 
template<typename T >
std::vector< T > & get (const std::string &fullname)
 
template<typename T >
void set (const std::string &fullname, std::vector< T > &&vec_in)
 
void initialiseNextProfile ()
 
void updateProfileInformation ()
 
void writeQuantitiesToObsdb ()
 
ioda::ObsSpace & getObsdb ()
 Return obsdb. More...
 
int getNumProfileLevels () const
 Return number of levels to which QC checks should be applied. More...
 
std::vector< float > & getGeoVaLVector (const std::string &variableName)
 Get GeoVaLs for a particular profile. More...
 
std::vector< float > & getObsDiag (const std::string &variableName)
 Get ObsDiags for a particular profile. More...
 
void resetProfileIndices ()
 
std::vector< ProfileDataHolderproduceProfileVector (const std::vector< std::string > &variableNamesInt, const std::vector< std::string > &variableNamesFloat, const std::vector< std::string > &variableNamesString, const std::vector< std::string > &variableNamesGeoVaLs, const std::vector< std::string > &variableNamesObsDiags)
 Produce a vector of all profiles, loading the requested variables into each one. More...
 
void updateAllProfiles (std::vector< ProfileDataHolder > &profiles)
 Read values from a collection of profiles and update information related to each one. More...
 

Private Member Functions

void resetProfileInformation ()
 
void updateEntireSampleData ()
 
void setFinalReportFlags ()
 Set final report flags based on the NumAnyErrors counter. More...
 
void setFlagged ()
 
template<typename T >
void updateValueIfPresent (const std::vector< T > &vecIn, const size_t &idxIn, std::vector< T > &vecOut, const size_t &idxOut)
 Transfer values from one vector to another (as long as neither is empty). More...
 
void getProfileIndicesInEntireSample (const std::string &groupname)
 Get indices in entire sample corresponding to current profile. More...
 
std::string getAssociatedVerticalCoordinate (const std::string &variableName) const
 

Private Attributes

std::unordered_map< std::string, boost::variant< std::vector< int >, std::vector< float >, std::vector< std::string > > > profileData_
 Container of each variable in the current profile. More...
 
std::unordered_map< std::string, std::vector< float > > GeoVaLData_
 Container of GeoVaLs in the current profile. More...
 
std::unordered_map< std::string, std::vector< float > > obsDiagData_
 Container of ObsDiags in the current profile. More...
 
ioda::ObsSpace & obsdb_
 Observation database. More...
 
const GeoVaLs *const geovals_
 GeoVaLs loaded by the filter. More...
 
const ObsDiagnostics *const obsdiags_
 ObsDiags loaded by the filter. More...
 
const DataHandlerParametersoptions_
 Configurable parameters. More...
 
const Variablesfiltervars_
 Filter variables. More...
 
std::vector< std::vector< bool > > & flagged_
 Flagged values. More...
 
std::unique_ptr< EntireSampleDataHandlerentireSampleDataHandler_
 Class that handles the entire data sample. More...
 
std::unique_ptr< ProfileIndicesprofileIndices_
 Class that handles profile indices. More...
 
std::vector< size_t > profileIndicesInEntireSample_
 Indices in the entire data sample that correspond to the current profile. More...
 

Detailed Description

Retrieve and store data for individual profiles. To do this, first the vector of values in the entire data sample is retrieved then the relevant data corresponding to this profile are extracted.

Definition at line 50 of file ProfileDataHandler.h.

Constructor & Destructor Documentation

◆ ProfileDataHandler()

ufo::ProfileDataHandler::ProfileDataHandler ( const ObsFilterData data,
const DataHandlerParameters options,
const std::vector< bool > &  apply,
const Variables filtervars,
std::vector< std::vector< bool >> &  flagged 
)

Definition at line 20 of file ProfileDataHandler.cc.

Member Function Documentation

◆ get()

template<typename T >
std::vector<T>& ufo::ProfileDataHandler::get ( const std::string &  fullname)
inline

Retrieve a vector containing the requested variable for the current profile.

  1. If the variable has previously been placed in a vector, return the vector.
  2. Otherwise obtain the vector from the entire data sample, as long as the entire sample is not empty. Also store the name of the variable, enabling it to be retrieved later.

Definition at line 64 of file ProfileDataHandler.h.

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

◆ getAssociatedVerticalCoordinate()

std::string ufo::ProfileDataHandler::getAssociatedVerticalCoordinate ( const std::string &  variableName) const
private

Get the name of the vertical coordinate that is used to determine the slant path locations for the variable variableName.

Definition at line 196 of file ProfileDataHandler.cc.

◆ getGeoVaLVector()

std::vector< float > & ufo::ProfileDataHandler::getGeoVaLVector ( const std::string &  variableName)

Get GeoVaLs for a particular profile.

Definition at line 211 of file ProfileDataHandler.cc.

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

◆ getNumProfileLevels()

int ufo::ProfileDataHandler::getNumProfileLevels ( ) const
inline

Return number of levels to which QC checks should be applied.

Definition at line 151 of file ProfileDataHandler.h.

Here is the caller graph for this function:

◆ getObsdb()

ioda::ObsSpace& ufo::ProfileDataHandler::getObsdb ( )
inline

Return obsdb.

Definition at line 148 of file ProfileDataHandler.h.

Here is the caller graph for this function:

◆ getObsDiag()

std::vector< float > & ufo::ProfileDataHandler::getObsDiag ( const std::string &  variableName)

Get ObsDiags for a particular profile.

Definition at line 258 of file ProfileDataHandler.cc.

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

◆ getProfileIndicesInEntireSample()

void ufo::ProfileDataHandler::getProfileIndicesInEntireSample ( const std::string &  groupname)
private

Get indices in entire sample corresponding to current profile.

Definition at line 67 of file ProfileDataHandler.cc.

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

◆ initialiseNextProfile()

void ufo::ProfileDataHandler::initialiseNextProfile ( )

Initialise the next profile prior to applying checks. Clears profileData_ and determines the profileIndices_ for the next profile.

Definition at line 43 of file ProfileDataHandler.cc.

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

◆ produceProfileVector()

std::vector< ProfileDataHolder > ufo::ProfileDataHandler::produceProfileVector ( const std::vector< std::string > &  variableNamesInt,
const std::vector< std::string > &  variableNamesFloat,
const std::vector< std::string > &  variableNamesString,
const std::vector< std::string > &  variableNamesGeoVaLs,
const std::vector< std::string > &  variableNamesObsDiags 
)

Produce a vector of all profiles, loading the requested variables into each one.

Definition at line 294 of file ProfileDataHandler.cc.

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

◆ resetProfileIndices()

void ufo::ProfileDataHandler::resetProfileIndices ( )
inline

Reset profile indices (required if it is desired to loop through the entire sample again).

Definition at line 161 of file ProfileDataHandler.h.

Here is the caller graph for this function:

◆ resetProfileInformation()

void ufo::ProfileDataHandler::resetProfileInformation ( )
private

Reset profile information (vectors and corresponding names). This should be called every time a new profile will be retrieved.

Definition at line 36 of file ProfileDataHandler.cc.

Here is the caller graph for this function:

◆ set()

template<typename T >
void ufo::ProfileDataHandler::set ( const std::string &  fullname,
std::vector< T > &&  vec_in 
)
inline

Directly set a vector for the current profile. Typically used to store variables that are used locally in checks (e.g. intermediate values). Also initialise a vector in the entire sample, allowing the data to be stored between checks.

Definition at line 104 of file ProfileDataHandler.h.

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

◆ setFinalReportFlags()

void ufo::ProfileDataHandler::setFinalReportFlags ( )
private

Set final report flags based on the NumAnyErrors counter.

Definition at line 125 of file ProfileDataHandler.cc.

Here is the caller graph for this function:

◆ setFlagged()

void ufo::ProfileDataHandler::setFlagged ( )
private

Update the 'flagged' vector based on any flags that may have changed during the checks. The QC flag group is hardocded but this could be changed to a configurable value if required.

Definition at line 138 of file ProfileDataHandler.cc.

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

◆ updateAllProfiles()

void ufo::ProfileDataHandler::updateAllProfiles ( std::vector< ProfileDataHolder > &  profiles)

Read values from a collection of profiles and update information related to each one.

Definition at line 317 of file ProfileDataHandler.cc.

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

◆ updateEntireSampleData()

void ufo::ProfileDataHandler::updateEntireSampleData ( )
private

If any variables in the current profile were modified by the checks, the equivalent variables in the entire sample are set to the modified values. The variables that are (potentially) modified are hardcoded but this could be changed to a configurable list if requred.

Definition at line 85 of file ProfileDataHandler.cc.

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

◆ updateProfileInformation()

void ufo::ProfileDataHandler::updateProfileInformation ( )

Update information for this profile. This function calls three other functions which take the following actions:

  1. Set final report flags in this profile,
  2. Modify 'flagged' vector for each filter variable based on check results,
  3. If any variables in the current profile were modified by the checks, the equivalent variables in the entire sample are set to the modified values.

Definition at line 49 of file ProfileDataHandler.cc.

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

◆ updateValueIfPresent()

template<typename T >
void ufo::ProfileDataHandler::updateValueIfPresent ( const std::vector< T > &  vecIn,
const size_t &  idxIn,
std::vector< T > &  vecOut,
const size_t &  idxOut 
)
inlineprivate

Transfer values from one vector to another (as long as neither is empty).

Definition at line 195 of file ProfileDataHandler.h.

Here is the caller graph for this function:

◆ writeQuantitiesToObsdb()

void ufo::ProfileDataHandler::writeQuantitiesToObsdb ( )

Write various quantities to the obsdb so they can be used in future QC checks. Use the method in EntireSampleDataHandler to do this.

Definition at line 62 of file ProfileDataHandler.cc.

Here is the caller graph for this function:

Member Data Documentation

◆ entireSampleDataHandler_

std::unique_ptr<EntireSampleDataHandler> ufo::ProfileDataHandler::entireSampleDataHandler_
private

Class that handles the entire data sample.

Definition at line 240 of file ProfileDataHandler.h.

◆ filtervars_

const Variables& ufo::ProfileDataHandler::filtervars_
private

Filter variables.

Definition at line 234 of file ProfileDataHandler.h.

◆ flagged_

std::vector<std::vector<bool> >& ufo::ProfileDataHandler::flagged_
private

Flagged values.

Definition at line 237 of file ProfileDataHandler.h.

◆ GeoVaLData_

std::unordered_map<std::string, std::vector <float> > ufo::ProfileDataHandler::GeoVaLData_
private

Container of GeoVaLs in the current profile.

Definition at line 216 of file ProfileDataHandler.h.

◆ geovals_

const GeoVaLs* const ufo::ProfileDataHandler::geovals_
private

GeoVaLs loaded by the filter.

Definition at line 225 of file ProfileDataHandler.h.

◆ obsdb_

ioda::ObsSpace& ufo::ProfileDataHandler::obsdb_
private

Observation database.

Definition at line 222 of file ProfileDataHandler.h.

◆ obsDiagData_

std::unordered_map<std::string, std::vector <float> > ufo::ProfileDataHandler::obsDiagData_
private

Container of ObsDiags in the current profile.

Definition at line 219 of file ProfileDataHandler.h.

◆ obsdiags_

const ObsDiagnostics* const ufo::ProfileDataHandler::obsdiags_
private

ObsDiags loaded by the filter.

Definition at line 228 of file ProfileDataHandler.h.

◆ options_

const DataHandlerParameters& ufo::ProfileDataHandler::options_
private

Configurable parameters.

Definition at line 231 of file ProfileDataHandler.h.

◆ profileData_

std::unordered_map<std::string, boost::variant <std::vector <int>, std::vector <float>, std::vector <std::string> > > ufo::ProfileDataHandler::profileData_
private

Container of each variable in the current profile.

Definition at line 213 of file ProfileDataHandler.h.

◆ profileIndices_

std::unique_ptr<ProfileIndices> ufo::ProfileDataHandler::profileIndices_
private

Class that handles profile indices.

Definition at line 243 of file ProfileDataHandler.h.

◆ profileIndicesInEntireSample_

std::vector<size_t> ufo::ProfileDataHandler::profileIndicesInEntireSample_
private

Indices in the entire data sample that correspond to the current profile.

Definition at line 246 of file ProfileDataHandler.h.


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