#include <GribApiCDMWriter_ImplAbstract.h>
Public Member Functions | |
GribApiCDMWriter_ImplAbstract (int gribVersion, const boost::shared_ptr< CDMReader > &cdmReader, const std::string &outputFile, const std::string &configFile) | |
virtual | ~GribApiCDMWriter_ImplAbstract () |
void | run () throw (CDMException) |
actually write the data | |
Protected Member Functions | |
virtual void | setGlobalAttributes () |
virtual void | setData (const boost::shared_ptr< Data > &data) |
virtual void | setProjection (const std::string &varName)=0 throw (CDMException) |
virtual void | setParameter (const std::string &varName, const FimexTime &fTime, double levelValue)=0 throw (CDMException) |
virtual void | setTime (const std::string &varName, const FimexTime &fTime) |
virtual void | setLevel (const std::string &varName, double levelValue)=0 |
virtual std::vector< double > | getLevels (const std::string &varName) throw (CDMException) |
virtual std::vector< FimexTime > | getTimes (const std::string &varName) throw (CDMException) |
virtual boost::shared_ptr< Data > | handleTypeScaleAndMissingData (const std::string &varName, const FimexTime &fTime, double levelValue, boost::shared_ptr< Data > inData)=0 |
virtual void | writeGribHandleToFile () |
xmlNode * | getNodePtr (const std::string &varName, const FimexTime &fTime, double levelValue) throw (CDMException) |
Protected Attributes | |
int | gribVersion |
const std::string | configFile |
const boost::shared_ptr< XMLDoc > | xmlConfig |
boost::shared_ptr< grib_handle > | gribHandle |
LoggerPtr | logger |
MetNoFimex::GribApiCDMWriter_ImplAbstract::GribApiCDMWriter_ImplAbstract | ( | int | gribVersion, | |
const boost::shared_ptr< CDMReader > & | cdmReader, | |||
const std::string & | outputFile, | |||
const std::string & | configFile | |||
) |
Constructor of the general writer. It should be called during construction of derived classes.
remember to call run to actually do something
virtual MetNoFimex::GribApiCDMWriter_ImplAbstract::~GribApiCDMWriter_ImplAbstract | ( | ) | [virtual] |
void MetNoFimex::GribApiCDMWriter_ImplAbstract::run | ( | ) | throw (CDMException) |
actually write the data
The run function has be to called after construction the object to actually fetch and write the data.
virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setGlobalAttributes | ( | ) | [protected, virtual] |
add the global attributes from the config to the default grib-handle
virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setData | ( | const boost::shared_ptr< Data > & | data | ) | [protected, virtual] |
virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setProjection | ( | const std::string & | varName | ) | throw (CDMException) [protected, pure virtual] |
set the projection parameters, throw an exception if none are available
varName |
CDMException | if parameters cannot be set |
Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.
virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setParameter | ( | const std::string & | varName, | |
const FimexTime & | fTime, | |||
double | levelValue | |||
) | throw (CDMException) [protected, pure virtual] |
Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.
virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setTime | ( | const std::string & | varName, | |
const FimexTime & | fTime | |||
) | [protected, virtual] |
virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::setLevel | ( | const std::string & | varName, | |
double | levelValue | |||
) | [protected, pure virtual] |
Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.
virtual std::vector<double> MetNoFimex::GribApiCDMWriter_ImplAbstract::getLevels | ( | const std::string & | varName | ) | throw (CDMException) [protected, virtual] |
get the levels from the cdm scaled to values used in grib (units/scale-factor) assign at least 1 level, give it a default value if none is found in the cdm
virtual std::vector<FimexTime> MetNoFimex::GribApiCDMWriter_ImplAbstract::getTimes | ( | const std::string & | varName | ) | throw (CDMException) [protected, virtual] |
get the times from the cdm as FimexTime (including unit) assign at least 1 time, give it a default value if none is found in the cdm
virtual boost::shared_ptr<Data> MetNoFimex::GribApiCDMWriter_ImplAbstract::handleTypeScaleAndMissingData | ( | const std::string & | varName, | |
const FimexTime & | fTime, | |||
double | levelValue, | |||
boost::shared_ptr< Data > | inData | |||
) | [protected, pure virtual] |
add the missing value to the gribHandle, rescale the data if needed and change the datatype if needed, change the missingValue of the data if need
Implemented in MetNoFimex::GribApiCDMWriter_Impl1, and MetNoFimex::GribApiCDMWriter_Impl2.
virtual void MetNoFimex::GribApiCDMWriter_ImplAbstract::writeGribHandleToFile | ( | ) | [protected, virtual] |
xmlNode* MetNoFimex::GribApiCDMWriter_ImplAbstract::getNodePtr | ( | const std::string & | varName, | |
const FimexTime & | fTime, | |||
double | levelValue | |||
) | throw (CDMException) [protected] |
get the node belonging to varName, level and time from the config file
varName | name of the variable | |
fTime | current time | |
level | curent level |
int MetNoFimex::GribApiCDMWriter_ImplAbstract::gribVersion [protected] |
const std::string MetNoFimex::GribApiCDMWriter_ImplAbstract::configFile [protected] |
const boost::shared_ptr<XMLDoc> MetNoFimex::GribApiCDMWriter_ImplAbstract::xmlConfig [protected] |
boost::shared_ptr<grib_handle> MetNoFimex::GribApiCDMWriter_ImplAbstract::gribHandle [protected] |