MI - Fimex
Public Member Functions | List of all members
MetNoFimex::GribFileMessage Class Reference

#include <GribFileIndex.h>

Public Member Functions

 GribFileMessage ()
 
 GribFileMessage (boost::shared_ptr< grib_handle > gh, const std::string &fileURL, long filePos, long msgPos, const std::vector< std::pair< std::string, boost::regex > > &members=std::vector< std::pair< std::string, boost::regex > >(), const std::vector< std::string > &extraKeys=std::vector< std::string >())
 
 GribFileMessage (boost::shared_ptr< XMLDoc >, std::string nsPrefix, xmlNodePtr node)
 
 GribFileMessage (xmlTextReaderPtr reader, const std::string &fileName)
 
 ~GribFileMessage ()
 
bool isValid () const
 test if this is a proper GribFileMessage or just the default constructor More...
 
std::string toString () const
 give a xml-string representation More...
 
const long getEdition () const
 accessors More...
 
const std::stringgetFileURL () const
 
const off_t getFilePosition () const
 
const size_t getMessageNumber () const
 messages number within a multi-message More...
 
const std::stringgetName () const
 
const std::stringgetShortName () const
 
boost::posix_time::ptime getValidTime () const
 
boost::posix_time::ptime getReferenceTime () const
 
long getTimeRangeIndicator () const
 return gribs timeRangeIndicator (0=instant, 2,4=accumulated) More...
 
long getLevelNumber () const
 
long getLevelType () const
 
size_t getTotalNumberOfEnsembles () const
 
size_t getPerturbationNumber () const
 
const std::map< std::string, long > & getOtherKeys () const
 
const std::vector< long > & getParameterIds () const
 
const std::stringgetTypeOfGrid () const
 
const GridDefinitiongetGridDefinition () const
 
size_t readData (std::vector< double > &data, double missingValue) const
 
size_t readLevelData (std::vector< double > &levelData, double missingValue, bool asimofHeader=false) const
 

Constructor & Destructor Documentation

MetNoFimex::GribFileMessage::GribFileMessage ( )
MetNoFimex::GribFileMessage::GribFileMessage ( boost::shared_ptr< grib_handle >  gh,
const std::string fileURL,
long  filePos,
long  msgPos,
const std::vector< std::pair< std::string, boost::regex > > &  members = std::vectorstd::pairstd::string, boost::regex > >(),
const std::vector< std::string > &  extraKeys = std::vectorstd::string >() 
)
Parameters
ghgrib_handle
fileURLurl of the input file
filePosstart of message in file
msgPosstart of real message within message (multimessage)
memberslist of member-names -> filepath-regexp
extraKeysadditional keys to read from grib-file (both grib1 and 2) (key -> type)
MetNoFimex::GribFileMessage::GribFileMessage ( boost::shared_ptr< XMLDoc ,
std::string  nsPrefix,
xmlNodePtr  node 
)
MetNoFimex::GribFileMessage::GribFileMessage ( xmlTextReaderPtr  reader,
const std::string fileName 
)
MetNoFimex::GribFileMessage::~GribFileMessage ( )

Member Function Documentation

const long MetNoFimex::GribFileMessage::getEdition ( ) const
const off_t MetNoFimex::GribFileMessage::getFilePosition ( ) const

Referenced by isValid().

const std::string& MetNoFimex::GribFileMessage::getFileURL ( ) const

Referenced by isValid().

const GridDefinition& MetNoFimex::GribFileMessage::getGridDefinition ( ) const

Referenced by getPerturbationNumber().

long MetNoFimex::GribFileMessage::getLevelNumber ( ) const
long MetNoFimex::GribFileMessage::getLevelType ( ) const
const size_t MetNoFimex::GribFileMessage::getMessageNumber ( ) const

messages number within a multi-message

Referenced by isValid().

const std::string& MetNoFimex::GribFileMessage::getName ( ) const

Referenced by isValid().

const std::map<std::string, long>& MetNoFimex::GribFileMessage::getOtherKeys ( ) const

get other keys - the other keys need to be available already during initialization

Returns
map with key -> value

Referenced by getPerturbationNumber().

const std::vector<long>& MetNoFimex::GribFileMessage::getParameterIds ( ) const

Get the parameter ids as list with the following meanings:

  • ed1: indicatorOfParameter, gribTablesVersionNo, identificationOfOriginatingGeneratingCentre;
  • ed2: parameterNumber, paramterCategory, discipline

Referenced by getPerturbationNumber().

size_t MetNoFimex::GribFileMessage::getPerturbationNumber ( ) const
inline

get the current perturbation/ensemble number

References getGridDefinition(), getOtherKeys(), getParameterIds(), getTypeOfGrid(), readData(), and readLevelData().

boost::posix_time::ptime MetNoFimex::GribFileMessage::getReferenceTime ( ) const

Referenced by isValid().

const std::string& MetNoFimex::GribFileMessage::getShortName ( ) const

Referenced by isValid().

long MetNoFimex::GribFileMessage::getTimeRangeIndicator ( ) const

return gribs timeRangeIndicator (0=instant, 2,4=accumulated)

Referenced by isValid().

size_t MetNoFimex::GribFileMessage::getTotalNumberOfEnsembles ( ) const
inline

give the total number of ensembles for this parameter

const std::string& MetNoFimex::GribFileMessage::getTypeOfGrid ( ) const

Referenced by getPerturbationNumber().

boost::posix_time::ptime MetNoFimex::GribFileMessage::getValidTime ( ) const
bool MetNoFimex::GribFileMessage::isValid ( ) const
inline
size_t MetNoFimex::GribFileMessage::readData ( std::vector< double > &  data,
double  missingValue 
) const

Read the data from the underlying source to the vector data. Data of at maximum data.size() will be read.

Parameters
datathe storage the data will be read to
missingValuethe missing- / fill-value the returned data will have
Returns
the actual amount of data read

Referenced by getPerturbationNumber().

size_t MetNoFimex::GribFileMessage::readLevelData ( std::vector< double > &  levelData,
double  missingValue,
bool  asimofHeader = false 
) const

Read the level-data from the underlying source to the vector levelData. In contrast to readData(), the levelData does not need to be pre-allocated, since levelData usually are small (a few hundred (in grib1 limited to 256)).

Parameters
levelDatathe storage the data will be read to
missingValuethe missing- / fill-value the returned data will have
Returns
the actual amount of data read

Referenced by getPerturbationNumber().

std::string MetNoFimex::GribFileMessage::toString ( ) const

give a xml-string representation

Referenced by isValid().


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