Go to the documentation of this file.
8 #ifndef UFO_PROFILE_PROFILEDATAHANDLER_H_
9 #define UFO_PROFILE_PROFILEDATAHANDLER_H_
12 #include <unordered_map>
16 #include "boost/variant.hpp"
18 #include "ioda/ObsDataVector.h"
19 #include "ioda/ObsSpace.h"
21 #include "oops/util/CompareNVectors.h"
22 #include "oops/util/missingValues.h"
53 std::vector<T>&
get(
const std::string &fullname)
57 std::string groupname;
67 return boost::get<std::vector<T>> (
profileData_[fullname]);
68 }
catch (boost::bad_get) {
69 throw eckit::BadParameter(
"Template parameter passed to boost::get"
70 " probably has the wrong type", Here());
73 std::vector <T> vec_prof;
77 if (!vec_all.empty()) {
80 vec_prof.emplace_back(vec_all[profileIndex]);
84 return boost::get<std::vector<T>> (
profileData_[fullname]);
92 void set(
const std::string &fullname, std::vector<T> &&vec_in)
109 template <
typename T>
111 std::vector <T> &vecOut,
const size_t &idxOut)
114 if (oops::anyVectorEmpty(vecIn, vecOut))
return;
115 vecOut[idxOut] = vecIn[idxIn];
130 void setFlagged(
const size_t nvars, std::vector<std::vector<bool>> &flagged);
140 std::unordered_map <std::string, boost::variant
141 <std::vector <int>, std::vector <float>, std::vector <std::string>>>
profileData_;
160 #endif // UFO_PROFILE_PROFILEDATAHANDLER_H_
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
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).
std::vector< size_t > profileIndicesInEntireSample_
Indices in the entire data sample that correspond to the current profile.
Determine indices of observations making up individual profiles. The indices are computed with respec...
ioda::ObsSpace & getObsdb()
Return obsdb.
void splitVarGroup(const std::string &vargrp, std::string &var, std::string &grp)
EntireSampleDataHandler & entireSampleDataHandler_
Class that handles the entire data sample.
const DataHandlerParameters & options_
Configurable parameters.
void setFinalReportFlags()
Set final report flags based on the NumAnyErrors counter.
const ProfileIndices & profileIndices_
Class that handles profile indices.
Options controlling the operation of the EntireSampleDataHandler and ProfileDataHandler classes.
void updateEntireSampleData()
Retrieve and store data for entire sample. This class uses lazy loading; vectors of variables are ret...
void getProfileIndicesInEntireSample(const std::string &groupname)
Get indices in entire sample corresponding to current profile.
bool getOptional(const std::string &groupname) const
Determine whether a variable group is optional or not.
size_t getEntriesPerProfile(const std::string &groupname) const
Determine number of entries per profile for a variable group.
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.
std::vector< T > & get(const std::string &fullname)
std::vector< T > & get(const std::string &fullname)
ProfileDataHandler(ioda::ObsSpace &obsdb, const DataHandlerParameters &options, EntireSampleDataHandler &entireSampleDataHandler, const ProfileIndices &profileIndices)
void set(const std::string &fullname, std::vector< T > &&vec_in)
void setFlagged(const size_t nvars, std::vector< std::vector< bool >> &flagged)
ioda::ObsSpace & obsdb_
Observation database.