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 FELTCDMREADER2_H_
00025 #define FELTCDMREADER2_H_
00026
00027 #include <string>
00028 #include <vector>
00029 #include <map>
00030 #include <boost/shared_ptr.hpp>
00031 #include "fimex/CDMReader.h"
00032 #include "fimex/CDMDimension.h"
00033 #include "fimex/Felt_Types.h"
00034 #include "fimex/Felt_File_Error.h"
00035 #include "fimex/ReplaceStringObject.h"
00036 #include <boost/date_time/posix_time/posix_time_types.hpp>
00037
00038 namespace MetNoFelt {
00039 class Felt_File2;
00040 }
00041
00042 namespace MetNoFimex
00043 {
00044 class XMLDoc;
00045
00046 class FeltCDMReader2 : public CDMReader
00047 {
00048 public:
00049 FeltCDMReader2(std::string filename, std::string configFilename) throw(CDMException);
00050 virtual ~FeltCDMReader2();
00051
00052 virtual boost::shared_ptr<Data> getDataSlice(const std::string& varName, size_t unLimDimPos) throw(CDMException);
00053
00054 private:
00055 const std::string filename;
00056 const std::string configFilename;
00057 boost::shared_ptr<MetNoFelt::Felt_File2> feltfile_;
00058 CDMDimension xDim;
00059 CDMDimension yDim;
00060 std::map<std::string, std::string> varNameFeltIdMap;
00061 std::vector<boost::posix_time::ptime> timeVec;
00062 std::map<std::string, std::vector<MetNoFelt::LevelPair> > levelVecMap;
00070 std::map<std::string, boost::shared_ptr<ReplaceStringObject> > templateReplacementAttributes;
00071 void init() throw(MetNoFelt::Felt_File_Error, CDMException);
00072
00073
00074 std::vector<std::string> initGetKnownFeltIdsFromXML(const XMLDoc& doc);
00075 void initAddGlobalAttributesFromXML(const XMLDoc& doc);
00079 std::map<std::string, std::string> initGetOptionsFromXML(const XMLDoc& doc);
00080 CDMDimension initAddTimeDimensionFromXML(const XMLDoc& doc);
00081 std::map<short, CDMDimension> initAddLevelDimensionsFromXML(const XMLDoc& doc);
00089 void readAdditionalAxisVariablesFromXPath(const XMLDoc& doc, const std::string& xpathLevelString, const std::map<std::string, boost::shared_ptr<ReplaceStringObject> >& templateReplacements) throw(MetNoFelt::Felt_File_Error);
00090 std::vector<double> readValuesFromXPath(const XMLDoc& doc, const std::string& variableXPath);
00091 void initAddProjectionFromXML(const XMLDoc& doc, std::string& projName, std::string& coordinates);
00092 void initAddVariablesFromXML(const XMLDoc& doc, const std::string& projName, const std::string& coordinates, const CDMDimension& timeDim, const std::map<short, CDMDimension>& levelDims);
00093
00094
00095 };
00096
00098 boost::shared_ptr<FeltCDMReader2> getFeltReader(std::string filename, std::string configFilename);
00099
00100 }
00101
00102 #endif