8 #ifndef UFO_PROFILE_ENTIRESAMPLEDATAHANDLER_H_
9 #define UFO_PROFILE_ENTIRESAMPLEDATAHANDLER_H_
18 #include <unordered_map>
22 #include "boost/variant.hpp"
24 #include "ioda/ObsDataVector.h"
25 #include "ioda/ObsSpace.h"
27 #include "oops/util/missingValues.h"
58 std::vector<T>&
get(
const std::string &fullname)
62 std::string groupname;
67 std::vector <T> vec_all;
74 return boost::get<std::vector<T>> (it_entireSampleData->second);
75 }
catch (boost::bad_get) {
76 throw eckit::BadParameter(
"Template parameter passed to boost::get for " +
77 fullname +
" probably has the wrong type", Here());
79 }
else if (
obsdb_.has(groupname, varname) || optional) {
81 if (entriesPerProfile == 0) {
87 if (
obsdb_.has(groupname, varname))
obsdb_.get_db(groupname, varname, vec_all);
102 template <
typename T>
108 get<T>(fullname).size() == 0)) {
110 std::string groupname;
113 std::vector <T> vec_all;
114 if (entriesPerProfile == 0) {
117 vec_all.assign(entriesPerProfile *
obsdb_.nrecs(),
126 template <
typename T>
128 const std::vector <T> &datavec)
131 if (datavec.empty())
return;
134 std::string groupname;
136 obsdb_.put_db(groupname, varname, datavec);
147 int defaultValue(
const std::vector <int> &vec,
const std::string &groupname);
150 float defaultValue(
const std::vector <float> &vec,
const std::string &groupname);
153 std::string
defaultValue(
const std::vector <std::string> &vec,
const std::string &groupname);
156 std::unordered_map <std::string, boost::variant
Options controlling the operation of the EntireSampleDataHandler and ProfileDataHandler classes.
size_t getEntriesPerProfile(const std::string &groupname) const
Determine number of entries per profile for a variable group.
bool getOptional(const std::string &groupname) const
Determine whether a variable group is optional or not.
Retrieve and store data for entire sample. This class uses lazy loading; vectors of variables are ret...
const DataHandlerParameters & options_
Configurable parameters.
void writeQuantitiesToObsdb()
ioda::ObsSpace & obsdb_
Observation database.
void putDataVector(const std::string &fullname, const std::vector< T > &datavec)
Put entire data vector on obsdb.
std::vector< T > & get(const std::string &fullname)
void initialiseVector(const std::string fullname)
std::unordered_map< std::string, boost::variant< std::vector< int >, std::vector< float >, std::vector< std::string > > > entireSampleData_
Container of each variable in the entire data set.
EntireSampleDataHandler(ioda::ObsSpace &obsdb, const DataHandlerParameters &options)
const float missingValueFloat
Missing value (float)
int defaultValue(const std::vector< int > &vec, const std::string &groupname)
Default value used to fill vector of integers.
const std::string missingValueString
Missing value (string)
const int missingValueInt
Missing value (int)
void splitVarGroup(const std::string &vargrp, std::string &var, std::string &grp)