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 #include "fimex/deprecated.h"
00037
00038 namespace MetNoFimex
00039 {
00040 class XMLDoc;
00041
00042 class FeltCDMReader : public CDMReader
00043 {
00044 public:
00048 DEPRECATED(FeltCDMReader(std::string filename, std::string configFilename) throw(CDMException));
00049 virtual ~FeltCDMReader();
00050
00051 virtual boost::shared_ptr<Data> getDataSlice(const std::string& varName, size_t unLimDimPos) throw(CDMException);
00052
00053 private:
00054 const std::string filename;
00055 const std::string configFilename;
00056 MetNoFelt::Felt_File feltFile;
00057 CDMDimension xDim;
00058 CDMDimension yDim;
00059 std::map<std::string, std::string> varNameFeltIdMap;
00060 std::vector<epoch_seconds> timeVec;
00061 std::map<std::string, std::vector<short> > levelVecMap;
00069 std::map<std::string, boost::shared_ptr<ReplaceStringObject> > templateReplacementAttributes;
00070 void init() throw(MetNoFelt::Felt_File_Error, CDMException);
00071
00072
00073 std::vector<std::string> initGetKnownFeltIdsFromXML(const XMLDoc& doc);
00074 void initAddGlobalAttributesFromXML(const XMLDoc& doc);
00078 std::map<std::string, std::string> initGetOptionsFromXML(const XMLDoc& doc);
00079 CDMDimension initAddTimeDimensionFromXML(const XMLDoc& doc);
00080 std::map<short, CDMDimension> initAddLevelDimensionsFromXML(const XMLDoc& doc);
00088 void readAdditionalAxisVariablesFromXPath(const XMLDoc& doc, const std::string& xpathLevelString, const std::map<std::string, boost::shared_ptr<ReplaceStringObject> >& templateReplacements) throw(MetNoFelt::Felt_File_Error);
00089 std::vector<double> readValuesFromXPath(const XMLDoc& doc, const std::string& variableXPath);
00090 void initAddProjectionFromXML(const XMLDoc& doc, std::string& projName, std::string& coordinates);
00091 void initAddVariablesFromXML(const XMLDoc& doc, const std::string& projName, const std::string& coordinates, const CDMDimension& timeDim, const std::map<short, CDMDimension>& levelDims);
00092
00093
00094 };
00095
00096 }
00097
00098 #endif