WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
WXP::MosFile Class Reference

This class reads MOS data files. More...

#include "../include/MosFile.h"

Public Types

enum  Model {
  NONE , NGM , ETA , NAM ,
  AVN , GFS , MRF , GFSX ,
  LAMP , PFM
}
 
enum  Type { UNK , WMO , BUFR , CDF }
 

Public Member Functions

 MosFile ()
 
 MosFile (const char *filename, int type)
 
 MosFile (const char *filename)
 
 MosFile (Filename &filename, int type)
 
 MosFile (Filename &filename)
 
 ~MosFile ()
 
int init ()
 
int setModel (int mod)
 
int setModel (const char *str)
 
const char * getModel ()
 
int open (const char *filename, int type)
 
int open (const char *filename)
 
int open (Filename &filename, int type)
 
int open (Filename &filename)
 
int rewind ()
 
int close ()
 
bool isOpen ()
 
int getDate (Date &rdate)
 
int read (MosData &data)
 
int decodeNGM (const char *str, MosData &data)
 
int decodeETA (const char *str, MosData &data)
 
int decodeNAM (const char *str, MosData &data)
 
int decodeAVN (const char *str, MosData &data)
 
int decodeGFS (const char *str, MosData &data)
 
int decodeMRF (const char *str, MosData &data)
 
int decodeGFSX (const char *str, MosData &data)
 
int decodeLAMP (const char *str, MosData &data)
 
const char * getWmo ()
 

Static Public Member Functions

static const char * getModel (int mod)
 

Detailed Description

This class reads MOS data files.

Author
Dan Vietor

Member Enumeration Documentation

◆ Model

MOS types

Enumerator
NGM 

NGM MOS Data

ETA 

Eta MOS Data

NAM 

NAM MOS Data

AVN 

Avation MOS Data

GFS 

GFS MOS Data

MRF 

MRF MOS Data

GFSX 

GFSX MOS Data

LAMP 

LAMP MOS Data

PFM 

Point Forecast Matrix

◆ Type

Enumerator
WMO 

WMO text data

BUFR 

BUFR data

CDF 

netCDF data

Constructor & Destructor Documentation

◆ MosFile() [1/5]

MosFile::MosFile ( )

Constructor. Initializes class values

References init().

◆ MosFile() [2/5]

MosFile::MosFile ( const char *  filename,
int  rtype 
)

Constructor. Opens the file

Parameters
filenameThe file name
rtypeThe file type (WMO, BUFR, CDF)

References init(), and open().

◆ MosFile() [3/5]

MosFile::MosFile ( const char *  filename)

Constructor. Opens the WMO formatted file

Parameters
filenameThe file name

References init(), open(), and WMO.

◆ MosFile() [4/5]

MosFile::MosFile ( Filename filename,
int  rtype 
)

Constructor. Opens the file

Parameters
filenameThe file name
rtypeThe file type (WMO, BUFR, CDF)

References init(), and open().

◆ MosFile() [5/5]

MosFile::MosFile ( Filename filename)

Constructor. Opens the WMO formatted file.

Parameters
filenameThe file name

References init(), open(), and WMO.

◆ ~MosFile()

MosFile::~MosFile ( )

Destructor.

References WXP::WmoParse::close(), and WMO.

Member Function Documentation

◆ close()

int MosFile::close ( )

Closes the data file

References WXP::WmoParse::close(), and WMO.

◆ decodeAVN()

int MosFile::decodeAVN ( const char *  str,
MosData data 
)

Decodes a single line of GFS MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References decodeGFS().

Referenced by read().

◆ decodeETA()

int MosFile::decodeETA ( const char *  str,
MosData data 
)

Decodes a single line of NAM MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References decodeNAM().

◆ decodeGFS()

int MosFile::decodeGFS ( const char *  str,
MosData data 
)

Decodes a single line of Aviation MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References WXP::StrLib::contains(), WXP::DateVal::day, WXP::StrLib::equal(), WXP::Date::getHour(), WXP::DateVal::hour, WXP::StrLib::length(), WXP::Const::MISS, WXP::DateVal::month, WXP::Date::set(), WXP::StrLib::subString(), WXP::StrLib::toInt(), and WXP::DateVal::year.

Referenced by decodeAVN(), and read().

◆ decodeGFSX()

int MosFile::decodeGFSX ( const char *  str,
MosData data 
)

Decodes a single line of MRF MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References WXP::StrLib::contains(), WXP::DateVal::day, WXP::StrLib::equal(), WXP::Date::getHour(), WXP::DateVal::hour, WXP::StrLib::length(), WXP::Const::MISS, WXP::DateVal::month, WXP::Date::set(), WXP::StrLib::subString(), WXP::StrLib::toInt(), and WXP::DateVal::year.

Referenced by decodeMRF(), and read().

◆ decodeLAMP()

int MosFile::decodeLAMP ( const char *  str,
MosData data 
)

Decodes a single line of LAMP MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References WXP::StrLib::contains(), WXP::DateVal::day, WXP::StrLib::equal(), WXP::DateVal::hour, WXP::StrLib::length(), WXP::Const::MISS, WXP::DateVal::month, WXP::Date::set(), WXP::StrLib::subString(), WXP::StrLib::toInt(), and WXP::DateVal::year.

Referenced by read().

◆ decodeMRF()

int MosFile::decodeMRF ( const char *  str,
MosData data 
)

Decodes a single line of GFSX MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References decodeGFSX().

Referenced by read().

◆ decodeNAM()

int MosFile::decodeNAM ( const char *  str,
MosData data 
)

Decodes a single line of Eta MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References WXP::StrLib::contains(), WXP::DateVal::day, WXP::StrLib::equal(), WXP::Date::getHour(), WXP::DateVal::hour, WXP::StrLib::length(), WXP::Const::MISS, WXP::DateVal::month, WXP::Date::set(), WXP::StrLib::subString(), WXP::StrLib::toInt(), and WXP::DateVal::year.

Referenced by decodeETA(), and read().

◆ decodeNGM()

int MosFile::decodeNGM ( const char *  str,
MosData data 
)

Decodes a single line of NGM MOS data from the MOS data file and inserts data into the class. It decodes the header for initial time info as well.

Parameters
strString to decode.
Return values
dataOutput data

References WXP::StrLib::contains(), WXP::DateVal::day, WXP::StrLib::equal(), WXP::Date::getHour(), WXP::DateVal::hour, WXP::StrLib::length(), WXP::Const::MISS, WXP::DateVal::month, WXP::Date::set(), WXP::StrLib::subString(), WXP::StrLib::toInt(), and WXP::DateVal::year.

Referenced by read().

◆ getDate()

int MosFile::getDate ( Date rdate)

Gets the date of the file

Return values
rdateDate class to put date information

Referenced by WXP::MosRaw::compute(), and WXP::MosPlot::draw().

◆ getModel() [1/2]

const char * MosFile::getModel ( )

Returns the model name label of open file

Returns
The model label

References getModel().

Referenced by WXP::MosRaw::compute(), WXP::MosPlot::draw(), and getModel().

◆ getModel() [2/2]

const char * MosFile::getModel ( int  mod)
static

Returns a model name label given model type

Parameters
modThe model type
Returns
The model label

References AVN, ETA, GFS, GFSX, LAMP, MRF, NAM, and NGM.

◆ getWmo()

const char * WXP::MosFile::getWmo ( )
inline

Returns the latest WMO header

References WXP::WmoParse::getHeader().

◆ init()

int MosFile::init ( )

Initializes the object

References NAM, setModel(), and WMO.

Referenced by MosFile(), MosFile(), MosFile(), MosFile(), and MosFile().

◆ isOpen()

bool WXP::MosFile::isOpen ( )
inline

Returns true if file open

Referenced by WXP::MosRaw::compute(), and WXP::MosPlot::draw().

◆ open() [1/4]

int MosFile::open ( const char *  file)

Opens the WMO formatted MOS file

Parameters
filenameThe file name

References open(), and WMO.

◆ open() [2/4]

int MosFile::open ( const char *  filename,
int  rtype 
)

Opens a MOS data file

Parameters
filenameFilename to open
rtypeType of file to open

References WXP::WmoParse::isOpen(), WXP::WmoParse::open(), and WMO.

Referenced by WXP::MosRaw::compute(), WXP::MosPlot::draw(), MosFile(), MosFile(), MosFile(), MosFile(), open(), and open().

◆ open() [3/4]

int MosFile::open ( Filename file)

Opens the WMO formatted MOS file

Parameters
filenameThe file name

References open(), and WMO.

◆ open() [4/4]

int MosFile::open ( Filename filename,
int  rtype 
)

Opens the MOS data file

Parameters
filenameThe file name
rtypeThe file type (WMO, BUFR, CDF)

References WXP::Filename::getDate(), WXP::WmoParse::isOpen(), WXP::WmoParse::open(), and WMO.

◆ read()

int MosFile::read ( MosData data)

Reads in a single report and populates the MosData class

Return values
dataThe MosData class to put the data into.

References AVN, decodeAVN(), decodeGFS(), decodeGFSX(), decodeLAMP(), decodeMRF(), decodeNAM(), decodeNGM(), ETA, WXP::WmoParse::getLine(), GFS, GFSX, WXP::MosData::init(), LAMP, MRF, NAM, NGM, and WMO.

Referenced by WXP::MosRaw::compute(), and WXP::MosPlot::draw().

◆ rewind()

int MosFile::rewind ( )

Rewinds the MOS file

References WXP::WmoParse::rewind(), and WMO.

Referenced by WXP::MosPlot::draw().

◆ setModel() [1/2]

int MosFile::setModel ( const char *  str)

Sets the model name to search for data

Parameters
strThe mdodel type

References AVN, ETA, GFS, GFSX, WXP::StrLib::iequal(), LAMP, MRF, NAM, NGM, and setModel().

◆ setModel() [2/2]

int MosFile::setModel ( int  mod)

Sets the model to search for in the file. This should be set before opening the file.

Parameters
modIntegral model designator

References AVN, ETA, GFS, GFSX, LAMP, MRF, NAM, NGM, and WXP::WmoParse::setHeader().

Referenced by WXP::MosRaw::compute(), WXP::MosPlot::draw(), init(), and setModel().


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