8 #ifndef UFO_PROFILE_PROFILEDATAHOLDER_H_
9 #define UFO_PROFILE_PROFILEDATAHOLDER_H_
12 #include <unordered_map>
16 #include "boost/variant.hpp"
40 void fill(
const std::vector <std::string> &variableNamesInt,
41 const std::vector <std::string> &variableNamesFloat,
42 const std::vector <std::string> &variableNamesString,
43 const std::vector <std::string> &variableNamesGeoVaLs,
44 const std::vector <std::string> &variableNamesObsDiags);
48 std::vector <T>&
get(
const std::string &fullname)
55 return boost::get<std::vector<T>> (it_profileData->second);
56 }
catch (boost::bad_get) {
57 throw eckit::BadParameter(
"Template parameter passed to boost::get for " +
58 fullname +
" probably has the wrong type", Here());
61 throw eckit::BadValue(
"Variable " + fullname +
" not present in profile. "
62 "Please add it to the relevant argument in the call "
63 "to produceProfileVector()", Here());
75 void set(
const std::string &fullname, std::vector<T> &&vec_in)
81 it_profileData->second = std::move(vec_in);
102 std::unordered_map <std::string, boost::variant
103 <std::vector <int>, std::vector <float>, std::vector <std::string>>>
profileData_;
Retrieve and store data for individual profiles. To do this, first the vector of values in the entire...
Profile data holder class.
std::vector< std::string > variableNamesInt_
Names of int variables.
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.
ProfileDataHolder(ProfileDataHandler &profileDataHandler)
int getNumProfileLevels() const
Get number of profile levels for this profile.
std::vector< float > & getObsDiagVector(const std::string &fullname)
Retrieve an ObsDiag vector if it is present. If not, throw an exception.
void moveValuesToHandler()
Move all values to the associated ProfileDataHandler.
std::vector< T > & get(const std::string &fullname)
Retrieve a vector if it is present. If not, throw an exception.
std::vector< std::string > variableNamesGeoVaLs_
Names of GeoVaLs.
ProfileDataHandler & profileDataHandler_
Profile data handler.
void set(const std::string &fullname, std::vector< T > &&vec_in)
Set values in a vector.
std::size_t numProfileLevels_
Number of profile levels.
void fill(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)
Fill profile with data.
std::vector< std::string > variableNamesFloat_
Names of float variables.
std::vector< std::string > variableNamesString_
Names of string variables.
std::unordered_map< std::string, std::vector< float > > profileGeoVaLs_
Container of GeoVaLs in the current profile.
std::vector< float > & getGeoVaLVector(const std::string &fullname)
Retrieve a GeoVaL vector if it is present. If not, throw an exception.
std::vector< std::string > variableNamesObsDiags_
Names of ObsDiags.
void checkObsSpaceSection(ufo::ObsSpaceSection section)
Check this profile is in the expected ObsSpace section (original or extended).
std::unordered_map< std::string, std::vector< float > > profileObsDiags_
Container of ObsDiags in the current profile.