8 #ifndef UFO_PROFILE_PROFILEDATAHANDLER_H_
9 #define UFO_PROFILE_PROFILEDATAHANDLER_H_
13 #include <unordered_map>
17 #include "boost/variant.hpp"
19 #include "ioda/ObsDataVector.h"
20 #include "ioda/ObsSpace.h"
22 #include "oops/util/CompareNVectors.h"
23 #include "oops/util/missingValues.h"
42 class ProfileDataHolder;
54 const std::vector <bool> &apply,
56 std::vector<std::vector<bool>> &flagged);
64 std::vector<T>&
get(
const std::string &fullname)
68 std::string groupname;
77 return boost::get<std::vector<T>> (it_profileData->second);
78 }
catch (boost::bad_get) {
79 throw eckit::BadParameter(
"Template parameter passed to boost::get for " +
80 fullname +
" probably has the wrong type", Here());
83 std::vector <T> vec_prof;
87 if (!vec_all.empty()) {
90 vec_prof.emplace_back(vec_all[profileIndex]);
94 return boost::get<std::vector<T>> (
profileData_[fullname]);
103 template <
typename T>
104 void set(
const std::string &fullname, std::vector<T> &&vec_in)
108 std::string groupname;
114 it_profileData->second = std::move(vec_in);
123 const std::vector <T>& profileData = this->get<T>(fullname);
157 std::vector <float>&
getObsDiag(
const std::string &variableName);
165 (
const std::vector <std::string> &variableNamesInt,
166 const std::vector <std::string> &variableNamesFloat,
167 const std::vector <std::string> &variableNamesString,
168 const std::vector <std::string> &variableNamesGeoVaLs,
169 const std::vector <std::string> &variableNamesObsDiags);
194 template <
typename T>
196 std::vector <T> &vecOut,
const size_t &idxOut)
199 if (oops::anyVectorEmpty(vecIn, vecOut))
return;
200 vecOut[idxOut] = vecIn[idxIn];
212 std::unordered_map <std::string, boost::variant
213 <std::vector <int>, std::vector <float>, std::vector <std::string>>>
profileData_;
216 std::unordered_map <std::string, std::vector <float>>
GeoVaLData_;
Options controlling the operation of the EntireSampleDataHandler and ProfileDataHandler classes.
GeoVaLs: geophysical values at locations.
ObsFilterData provides access to all data related to an ObsFilter.
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
ProfileDataHandler(const ObsFilterData &data, const DataHandlerParameters &options, const std::vector< bool > &apply, const Variables &filtervars, std::vector< std::vector< bool >> &flagged)
std::vector< T > & get(const std::string &fullname)
const DataHandlerParameters & options_
Configurable parameters.
void updateAllProfiles(std::vector< ProfileDataHolder > &profiles)
Read values from a collection of profiles and update information related to each one.
std::unique_ptr< EntireSampleDataHandler > entireSampleDataHandler_
Class that handles the entire data sample.
void set(const std::string &fullname, std::vector< T > &&vec_in)
std::vector< float > & getGeoVaLVector(const std::string &variableName)
Get GeoVaLs for a particular profile.
const Variables & filtervars_
Filter variables.
const ObsDiagnostics *const obsdiags_
ObsDiags loaded by the filter.
std::unordered_map< std::string, std::vector< float > > obsDiagData_
Container of ObsDiags in the current profile.
void updateEntireSampleData()
std::vector< ProfileDataHolder > 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.
void initialiseNextProfile()
int getNumProfileLevels() const
Return number of levels to which QC checks should be applied.
std::unique_ptr< ProfileIndices > profileIndices_
Class that handles profile indices.
std::vector< float > & getObsDiag(const std::string &variableName)
Get ObsDiags for a particular profile.
std::unordered_map< std::string, std::vector< float > > GeoVaLData_
Container of GeoVaLs in the current profile.
void updateProfileInformation()
ioda::ObsSpace & obsdb_
Observation database.
void resetProfileIndices()
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).
void setFinalReportFlags()
Set final report flags based on the NumAnyErrors counter.
void writeQuantitiesToObsdb()
std::vector< std::vector< bool > > & flagged_
Flagged values.
void getProfileIndicesInEntireSample(const std::string &groupname)
Get indices in entire sample corresponding to current profile.
ioda::ObsSpace & getObsdb()
Return obsdb.
void resetProfileInformation()
std::string getAssociatedVerticalCoordinate(const std::string &variableName) const
std::vector< size_t > profileIndicesInEntireSample_
Indices in the entire data sample that correspond to the current profile.
const GeoVaLs *const geovals_
GeoVaLs loaded by the filter.
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.
void splitVarGroup(const std::string &vargrp, std::string &var, std::string &grp)