Go to the documentation of this file.
16 #include "eckit/mpi/Comm.h"
18 #include "oops/util/Printable.h"
20 #include "ioda/distribution/Distribution.h"
35 template<
typename FrameType>
38 typedef std::map<std::string, std::vector<FrameType>>
FrameStore;
46 bool has(
const std::string & GroupName,
const std::string & VarName) {
47 std::string VarGrpName = VarName +
"@" + GroupName;
52 std::string GrpVarName = Iframe->first;
53 std::size_t Spos = GrpVarName.find(
"@");
54 return GrpVarName.substr(Spos+1);
57 std::string GrpVarName = Iframe->first;
58 std::size_t Spos = GrpVarName.find(
"@");
59 return GrpVarName.substr(0, Spos);
63 void get_data(
const std::string & GroupName,
const std::string & VarName,
64 std::vector<FrameType> & VarData) {
65 std::string VarGrpName = VarName +
"@" + GroupName;
68 void put_data(
const std::string & GroupName,
const std::string & VarName,
69 const std::vector<FrameType> & VarData) {
70 std::string VarGrpName = VarName +
"@" + GroupName;
192 std::string & VarName);
194 IodaIO(
const std::string & FileName,
const std::string & FileMode,
195 const std::size_t MaxFrameSize);
202 std::string
fname()
const;
203 std::string
fmode()
const;
205 std::size_t
nlocs()
const;
206 std::size_t
nvars()
const;
238 std::string
var_dtype(
const std::string &,
const std::string &);
240 std::vector<std::size_t>
var_shape(
const std::string &,
const std::string &);
242 std::vector<std::size_t>
file_shape(
const std::string &,
const std::string &);
244 std::string
file_name(
const std::string &,
const std::string &);
246 std::string
file_type(
const std::string &,
const std::string &);
248 std::size_t
var_id(
const std::string &,
const std::string &);
250 void grp_var_insert(
const std::string & GroupName,
const std::string & VarName,
251 const std::string & VarType,
const std::vector<std::size_t> & VarShape,
252 const std::string & FileVarName,
const std::string & FileType,
253 const std::size_t MaxStringSize = 0);
272 void dim_insert(
const std::string &,
const std::size_t);
307 std::vector<int> & VarData) {
311 std::vector<int> & VarData) {
332 std::vector<float> & VarData) {
336 std::vector<float> & VarData) {
357 std::vector<std::string> & VarData) {
361 std::vector<std::string> & VarData) {
368 virtual void DimInsert(
const std::string & Name,
const std::size_t Size) = 0;
375 virtual void GrpVarInsert(
const std::string & GroupName,
const std::string & VarName,
376 const std::string & VarType,
const std::vector<std::size_t> & VarShape,
377 const std::string & FileVarName,
const std::string & FileType,
378 const std::size_t MaxStringSize) = 0;
425 #endif // IO_IODAIO_H_
std::vector< int > frame_int_get_data(FrameIntIter &iframe)
VarInfoMap::const_iterator VarIter
group-variable map, variable iterator
void frame_float_get_data(std::string &GroupName, std::string &VarName, std::vector< float > &VarData)
void grp_var_insert(const std::string &GroupName, const std::string &VarName, const std::string &VarType, const std::vector< std::size_t > &VarShape, const std::string &FileVarName, const std::string &FileType, const std::size_t MaxStringSize=0)
std::size_t num_unexpect_dtypes_
count of unexpected data types
void dim_insert(const std::string &, const std::size_t)
std::string get_vname(FrameStoreIter &Iframe)
std::vector< std::size_t > file_shape
std::string fname() const
bool dim_exists(const std::string &)
bool frame_string_has(std::string &GroupName, std::string &VarName)
bool frame_int_has(std::string &GroupName, std::string &VarName)
FrameDataMap< int >::FrameStoreIter FrameIntIter
GroupVarInfoMap::const_iterator GroupIter
group-variable map, group iterator
std::string frame_string_get_vname(FrameStringIter &iframe)
std::size_t nlocs() const
FrameInfo frame_info_
frame information vector
FrameStringIter frame_string_end()
std::size_t max_frame_size_
maximum frame size
FrameInfo::const_iterator FrameIter
std::string fmode_
file mode
void frame_string_get_data(std::string &GroupName, std::string &VarName, std::vector< std::string > &VarData)
std::vector< FrameInfoRec > FrameInfo
frame information map
std::unique_ptr< FrameDataMap< int > > int_frame_data_
Containers for file frame.
bool has(const std::string &GroupName, const std::string &VarName)
std::string frame_int_get_gname(FrameIntIter &iframe)
FrameIntIter frame_int_begin()
std::size_t frame_start(FrameIter &)
start value of current frame
DimInfoMap dim_info_
dimension information map
virtual void InitializeFrame()=0
std::string var_name(VarIter)
virtual void GrpVarInsert(const std::string &GroupName, const std::string &VarName, const std::string &VarType, const std::vector< std::size_t > &VarShape, const std::string &FileVarName, const std::string &FileType, const std::size_t MaxStringSize)=0
std::string fmode() const
void frame_write(FrameIter &)
write from the frame containers into the file
std::vector< FrameType > get_data(FrameStoreIter &Iframe)
std::size_t dim_name_size(const std::string &)
void frame_int_get_data(std::string &GroupName, std::string &VarName, std::vector< int > &VarData)
void frame_float_put_data(std::string &GroupName, std::string &VarName, std::vector< float > &VarData)
void frame_read(FrameIter &)
read from the file into the frame containers
virtual void FinalizeFrame()=0
FrameIntIter frame_int_end()
bool frame_float_has(std::string &GroupName, std::string &VarName)
std::size_t var_id(VarIter)
std::unique_ptr< FrameDataMap< float > > float_frame_data_
std::map< std::string, std::vector< FrameType > > FrameStore
std::string get_gname(FrameStoreIter &Iframe)
std::string dim_id_name(const int &)
VarIter var_end(GroupIter)
void frame_finalize()
finalize frame access
int dim_name_id(const std::string &)
virtual void DimInsert(const std::string &Name, const std::size_t Size)=0
std::size_t num_excess_dims_
count of too many dimensions
FrameFloatIter frame_float_begin()
bool unexpected_data_types() const
std::size_t nvars_
number of unique variables
void frame_data_init()
initialize the frame data container
FrameStore frame_container_
std::string frame_int_get_vname(FrameIntIter &iframe)
std::string frame_float_get_vname(FrameFloatIter &iframe)
FrameIter frame_end()
ending frame iterator
std::string file_name(VarIter)
void get_data(const std::string &GroupName, const std::string &VarName, std::vector< FrameType > &VarData)
void frame_info_init(std::size_t MaxVarSize)
initialize the frame info container
std::string file_type(VarIter)
std::size_t dim_id_size(const int &)
std::vector< std::string > frame_string_get_data(FrameStringIter &iframe)
GroupVarInfoMap grp_var_info_
group-variable information map
std::string frame_float_get_gname(FrameFloatIter &iframe)
FrameInfoRec(const std::size_t Start, const std::size_t Size)
FrameFloatIter frame_float_end()
FrameIter frame_begin()
beginning frame iterator
std::vector< float > frame_float_get_data(FrameFloatIter &iframe)
void frame_initialize()
initialize frame access
std::map< std::string, DimInfoRec > DimInfoMap
dimension information map
std::size_t frame_size(FrameIter &)
size value of current frame
FrameDataMap< std::string >::FrameStoreIter FrameStringIter
void frame_string_put_data(std::string &GroupName, std::string &VarName, std::vector< std::string > &VarData)
VarIter var_begin(GroupIter)
FrameStore::iterator FrameStoreIter
FrameDataMap< float >::FrameStoreIter FrameFloatIter
std::string var_dtype(VarIter)
virtual void WriteFrame(IodaIO::FrameIter &iframe)=0
std::size_t dim_size(DimIter)
std::string fname_
file name
std::string dim_name(DimIter)
bool grp_var_exists(const std::string &, const std::string &)
virtual void ReadFrame(IodaIO::FrameIter &iframe)=0
std::vector< std::string > dim_names
IodaIO(const std::string &FileName, const std::string &FileMode, const std::size_t MaxFrameSize)
std::vector< std::size_t > var_shape(VarIter)
DimInfoMap::const_iterator DimIter
std::string frame_string_get_gname(FrameStringIter &iframe)
std::map< std::string, VarInfoRec > VarInfoMap
variable information map
std::vector< std::size_t > shape
std::size_t nvars() const
void put_data(const std::string &GroupName, const std::string &VarName, const std::vector< FrameType > &VarData)
FrameStringIter frame_string_begin()
std::unique_ptr< FrameDataMap< std::string > > string_frame_data_
void frame_int_put_data(std::string &GroupName, std::string &VarName, std::vector< int > &VarData)
File access class for IODA.
static void ExtractGrpVarName(const std::string &Name, std::string &GroupName, std::string &VarName)
std::string group_name(GroupIter)
std::size_t nlocs_
number of unique locations
void frame_info_insert(std::size_t Start, std::size_t Size)
insert item into the frame info container
std::vector< std::size_t > file_shape(VarIter)
std::map< std::string, VarInfoMap > GroupVarInfoMap
group-variable information map