FV3 Bundle
ioda::OdbApiIO Class Reference

Implementation of IodaIO for ODB API. More...

#include <OdbApiIO.h>

Inheritance diagram for ioda::OdbApiIO:
[legend]
Collaboration diagram for ioda::OdbApiIO:
[legend]

Public Member Functions

 OdbApiIO (const std::string &FileName, const std::string &FileMode, const std::size_t &Nlocs, const std::size_t &Nobs, const std::size_t &Nrecs, const std::size_t &Nvars)
 
 ~OdbApiIO ()
 
void ReadVar (const std::string &VarName, int *VarData)
 
void ReadVar (const std::string &VarName, float *VarData)
 
void ReadVar (const std::string &VarName, double *VarData)
 
void WriteVar (const std::string &VarName, int *VarData)
 
void WriteVar (const std::string &VarName, float *VarData)
 
void WriteVar (const std::string &VarName, double *VarData)
 
void ReadDateTime (int *VarDate, int *VarTime)
 
- Public Member Functions inherited from ioda::IodaIO
virtual ~IodaIO ()=0
 
std::string fname () const
 
std::string fmode () const
 
std::size_t nlocs ()
 
std::size_t nobs ()
 
std::size_t nrecs ()
 
std::size_t nvars ()
 

Static Public Member Functions

static const std::string classname ()
 classname method for object counter More...
 

Private Member Functions

void print (std::ostream &os) const
 
template<class T >
void ReadVarTemplate (const std::string &VarName, T *VarData)
 

Private Attributes

odbql * db_ = nullptr
 pointer to odbql object More...
 

Additional Inherited Members

- Protected Attributes inherited from ioda::IodaIO
std::string fname_
 file name More...
 
std::string fmode_
 file mode ("r" -> read, "w" -> overwrite, "W" -> create and write) More...
 
std::size_t nlocs_
 number of unique locations More...
 
std::size_t nobs_
 number of unique observations More...
 
std::size_t nrecs_
 number of unique records More...
 
std::size_t nvars_
 number of unique variables More...
 

Detailed Description

Implementation of IodaIO for ODB API.

The OdbOpiIO class defines the constructor and methods for the abstract class IodaIO.

Author
Steven Vahl (NCAR)

Definition at line 37 of file OdbApiIO.h.

Constructor & Destructor Documentation

◆ OdbApiIO()

ioda::OdbApiIO::OdbApiIO ( const std::string &  FileName,
const std::string &  FileMode,
const std::size_t &  Nlocs,
const std::size_t &  Nobs,
const std::size_t &  Nrecs,
const std::size_t &  Nvars 
)

This constructor will open the ODB API file. If opening in read mode, the parameters nlocs, nobs, nrecs and nvars will be set by querying the size of dimensions of the same names in the input file. If opening in write mode, the parameters will be set from the same named arguements to this constructor.

Parameters
[in]FileNamePath to the ODB API file
[in]FileMode"r" for read, "w" for overwrite to an existing file and "W" for create and write to a new file.
[in]NlocsNumber of unique locations in the obs data.
[in]NobsNumber of unique observations in the obs data.
[in]NrecsNumber of unique records in the obs data. Records are atomic units that will remain intact when obs are distributed across muliple process elements. A single radiosonde sounding would be an example.
[in]NvarsNumber of unique varibles in the obs data.

Definition at line 51 of file OdbApiIO.cc.

◆ ~OdbApiIO()

ioda::OdbApiIO::~OdbApiIO ( )

Definition at line 161 of file OdbApiIO.cc.

Member Function Documentation

◆ classname()

static const std::string ioda::OdbApiIO::classname ( )
inlinestatic

classname method for object counter

This method is supplied for the ObjectCounter base class. It defines a name to identify an object of this class for reporting by OOPS.

Definition at line 47 of file OdbApiIO.h.

◆ print()

void ioda::OdbApiIO::print ( std::ostream &  os) const
private

Definition at line 339 of file OdbApiIO.cc.

◆ ReadDateTime()

void ioda::OdbApiIO::ReadDateTime ( int *  VarDate,
int *  VarTime 
)
virtual

Implements ioda::IodaIO.

Definition at line 326 of file OdbApiIO.cc.

◆ ReadVar() [1/3]

void ioda::OdbApiIO::ReadVar ( const std::string &  VarName,
int *  VarData 
)
virtual

Implements ioda::IodaIO.

Definition at line 266 of file OdbApiIO.cc.

◆ ReadVar() [2/3]

void ioda::OdbApiIO::ReadVar ( const std::string &  VarName,
float *  VarData 
)
virtual

Implements ioda::IodaIO.

Definition at line 273 of file OdbApiIO.cc.

◆ ReadVar() [3/3]

void ioda::OdbApiIO::ReadVar ( const std::string &  VarName,
double *  VarData 
)
virtual

Implements ioda::IodaIO.

Definition at line 280 of file OdbApiIO.cc.

◆ ReadVarTemplate()

template<class T >
void ioda::OdbApiIO::ReadVarTemplate ( const std::string &  VarName,
T VarData 
)
private

This method selects the data in the column called VarName and loads it into the returned array VarData. The caller is responsible for allocating the memory for the VarData array.

Parameters
[in]VarNameName of variable to select
[in/out]VarData Pointer to the array where the data is loaded.

Definition at line 186 of file OdbApiIO.cc.

◆ WriteVar() [1/3]

void ioda::OdbApiIO::WriteVar ( const std::string &  VarName,
int *  VarData 
)
virtual

Implements ioda::IodaIO.

Definition at line 287 of file OdbApiIO.cc.

◆ WriteVar() [2/3]

void ioda::OdbApiIO::WriteVar ( const std::string &  VarName,
float *  VarData 
)
virtual

Implements ioda::IodaIO.

Definition at line 300 of file OdbApiIO.cc.

◆ WriteVar() [3/3]

void ioda::OdbApiIO::WriteVar ( const std::string &  VarName,
double *  VarData 
)
virtual

Implements ioda::IodaIO.

Definition at line 313 of file OdbApiIO.cc.

Member Data Documentation

◆ db_

odbql* ioda::OdbApiIO::db_ = nullptr
private

pointer to odbql object

This data member is a pointer to a odbql type. The odbql type is returned by the odbql_open function and is used by all following odb api functions to interact with the odb api file.

Definition at line 83 of file OdbApiIO.h.


The documentation for this class was generated from the following files: