FV3 Bundle
ioda::IodaIO Class Referenceabstract

File access class for IODA. More...

#include <IodaIO.h>

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

Public Member Functions

virtual ~IodaIO ()=0
 
virtual void ReadVar (const std::string &VarName, int *VarData)=0
 
virtual void ReadVar (const std::string &VarName, float *VarData)=0
 
virtual void ReadVar (const std::string &VarName, double *VarData)=0
 
virtual void WriteVar (const std::string &VarName, int *VarData)=0
 
virtual void WriteVar (const std::string &VarName, float *VarData)=0
 
virtual void WriteVar (const std::string &VarName, double *VarData)=0
 
virtual void ReadDateTime (int *VarDate, int *VarTime)=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 ()
 

Protected Attributes

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

File access class for IODA.

The IodaIO class provides the interface for file access. Note that IodaIO is an abstract base class.

Eventually, we want to get to the same file format for every obs type. Currently we are defining this as follows. A file can contain any number of variables. Each variable is a 1D vector that is nlocs long. Variables can contain missing values.

There are four dimensions defined in the file:

nlocs: number of locations (length of each variable) nvars: number of variables nobs: number of observations (equal to nlocs * nvars) nrecs: number of records

A record is an atomic unit that is to stay intact when distributing observations across multiple processes.

Older netcdf files have either a single variable, or have multiple variables (satellite channels, eg) flattened out into a single variable. These vectors are nobs long. Locations will be repeated in the case of multiple variables so the ObsSpace constructor (client of this class) needs to reshape these vectors into a set of variables that correspond to the new file format above.

For now, limit the write interface to writing 1D vectors that are nlocs in length. This may be too restrictive, so we should revisit this in the future.

The constructor that you fill in a subclass is responsible for:

  1. Open the file The file name and mode (read, write) is passed in to the subclass constructor via a call to the factory method Create in the class IodaIOfactory.
  2. The following data members are set according to the file mode

    • nlocs_
    • nobs_
    • nrecs_
    • nvars_

    If in read mode, metadata from the input file are used to set the data members If in write mode, the data members are set from the constructor arguments

Author
Stephen Herbener (JCSDA)

Definition at line 69 of file src/fileio/IodaIO.h.

Constructor & Destructor Documentation

◆ ~IodaIO()

ioda::IodaIO::~IodaIO ( )
pure virtual

Definition at line 17 of file IodaIO.cc.

Member Function Documentation

◆ fmode()

std::string ioda::IodaIO::fmode ( ) const

This method returns the mode (read, write, etc) for access to the file.

Definition at line 33 of file IodaIO.cc.

◆ fname()

std::string ioda::IodaIO::fname ( ) const

This method returns the path to the file.

Definition at line 24 of file IodaIO.cc.

◆ nlocs()

std::size_t ioda::IodaIO::nlocs ( )

This method returns the number of unique locations in the obs data.

Definition at line 42 of file IodaIO.cc.

◆ nobs()

std::size_t ioda::IodaIO::nobs ( )

This method returns the number of unique observations in the obs data.

Definition at line 51 of file IodaIO.cc.

◆ nrecs()

std::size_t ioda::IodaIO::nrecs ( )

This method returns the number of unique recoreds in the obs data. A record is an atomic unit that will remain intact during distribution across multiple process elements. An example is a single sounding in radiosonde obs data.

Definition at line 63 of file IodaIO.cc.

◆ nvars()

std::size_t ioda::IodaIO::nvars ( )

This method returns the number of unique variables in the obs data.

Definition at line 72 of file IodaIO.cc.

◆ ReadDateTime()

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

Implemented in ioda::OdbApiIO, and ioda::NetcdfIO.

◆ ReadVar() [1/3]

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

Implemented in ioda::OdbApiIO, and ioda::NetcdfIO.

◆ ReadVar() [2/3]

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

Implemented in ioda::OdbApiIO, and ioda::NetcdfIO.

◆ ReadVar() [3/3]

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

Implemented in ioda::OdbApiIO, and ioda::NetcdfIO.

◆ WriteVar() [1/3]

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

Implemented in ioda::OdbApiIO, and ioda::NetcdfIO.

◆ WriteVar() [2/3]

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

Implemented in ioda::OdbApiIO, and ioda::NetcdfIO.

◆ WriteVar() [3/3]

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

Implemented in ioda::OdbApiIO, and ioda::NetcdfIO.

Member Data Documentation

◆ fmode_

std::string ioda::IodaIO::fmode_
protected

file mode ("r" -> read, "w" -> overwrite, "W" -> create and write)

Definition at line 104 of file src/fileio/IodaIO.h.

◆ fname_

std::string ioda::IodaIO::fname_
protected

file name

Definition at line 101 of file src/fileio/IodaIO.h.

◆ nlocs_

std::size_t ioda::IodaIO::nlocs_
protected

number of unique locations

Definition at line 107 of file src/fileio/IodaIO.h.

◆ nobs_

std::size_t ioda::IodaIO::nobs_
protected

number of unique observations

Definition at line 110 of file src/fileio/IodaIO.h.

◆ nrecs_

std::size_t ioda::IodaIO::nrecs_
protected

number of unique records

Definition at line 113 of file src/fileio/IodaIO.h.

◆ nvars_

std::size_t ioda::IodaIO::nvars_
protected

number of unique variables

Definition at line 116 of file src/fileio/IodaIO.h.


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