00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FELTCDMREADER_H_
00025 #define FELTCDMREADER_H_
00026
00027 #include <string>
00028 #include <vector>
00029 #include <map>
00030 #include <boost/shared_ptr.hpp>
00031 #include "fimex/Felt_File.h"
00032 #include "fimex/CDMReader.h"
00033 #include "fimex/CDMDimension.h"
00034 #include "fimex/ReplaceStringObject.h"
00035 #include "fimex/Utils.h"
00036
00037 namespace MetNoFimex
00038 {
00039 class XMLDoc;
00040
00041 class FeltCDMReader : public CDMReader
00042 {
00043 public:
00044 FeltCDMReader(std::string filename, std::string configFilename) throw(CDMException);
00045 virtual ~FeltCDMReader();
00046
00047 virtual boost::shared_ptr<Data> getDataSlice(const std::string& varName, size_t unLimDimPos) throw(CDMException);
00048
00049 private:
00050 const std::string filename;
00051 const std::string configFilename;
00052 MetNoFelt::Felt_File feltFile;
00053 CDMDimension xDim;
00054 CDMDimension yDim;
00055 std::map<std::string, std::string> varNameFeltIdMap;
00056 std::vector<epoch_seconds> timeVec;
00057 std::map<std::string, std::vector<short> > levelVecMap;
00065 std::map<std::string, boost::shared_ptr<ReplaceStringObject> > templateReplacementAttributes;
00066 void init() throw(MetNoFelt::Felt_File_Error, CDMException);
00067
00068
00069 std::vector<std::string> initGetKnownFeltIdsFromXML(const XMLDoc& doc);
00070 void initAddGlobalAttributesFromXML(const XMLDoc& doc);
00074 std::map<std::string, std::string> initGetOptionsFromXML(const XMLDoc& doc);
00075 CDMDimension initAddTimeDimensionFromXML(const XMLDoc& doc);
00076 std::map<short, CDMDimension> initAddLevelDimensionsFromXML(const XMLDoc& doc);
00084 void readAdditionalAxisVariablesFromXPath(const XMLDoc& doc, const std::string& xpathLevelString, const std::map<std::string, boost::shared_ptr<ReplaceStringObject> >& templateReplacements) throw(MetNoFelt::Felt_File_Error);
00085 std::vector<double> readValuesFromXPath(const XMLDoc& doc, const std::string& variableXPath);
00086 void initAddProjectionFromXML(const XMLDoc& doc, std::string& projName, std::string& coordinates);
00087 void initAddVariablesFromXML(const XMLDoc& doc, const std::string& projName, const std::string& coordinates, const CDMDimension& timeDim, const std::map<short, CDMDimension>& levelDims);
00088
00089
00090 };
00091
00092 }
00093
00094 #endif