# MI - Fimex: include/fimex/GribCDMReader.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

# include/fimex/GribCDMReader.h

Go to the documentation of this file.

    00001 /*
    00002  * Fimex, GribCDMReader.h
    00003  *
    00004  * (C) Copyright 2009, met.no
    00005  *
    00006  * Project Info:  https://wiki.met.no/fimex/start
    00007  *
    00008  * This library is free software; you can redistribute it and/or modify it
    00009  * under the terms of the GNU Lesser General Public License as published by
    00010  * the Free Software Foundation; either version 2.1 of the License, or
    00011  * (at your option) any later version.
    00012  *
    00013  * This library is distributed in the hope that it will be useful, but
    00014  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    00015  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
    00016  * License for more details.
    00017  *
    00018  * You should have received a copy of the GNU Lesser General Public
    00019  * License along with this library; if not, write to the Free Software
    00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
    00021  * USA.
    00022  *
    00023  *  Created on: Sep 9, 2009
    00024  *      Author: Heiko Klein
    00025  */
    00026
    00027 #ifndef GRIBCDMREADER_H_
    00028 #define GRIBCDMREADER_H_
    00029
    00030 #include <vector>
    00031 #include <map>
    00032 #include <set>
    00033 #include "boost/shared_ptr.hpp"
    00034 #include "fimex/GribFileIndex.h"
    00035 #include "fimex/CDMReader.h"
    00036 #include "fimex/ReplaceStringObject.h"
    00037
    00038 namespace MetNoFimex
    00039 {
    00040
    00041 // forward decl.
    00042 class CDM;
    00043 class CDMDimension;
    00044 class Data;
    00045
    00046 class GribCDMReader: public MetNoFimex::CDMReader
    00047 {
    00048 public:
    00049     GribCDMReader(const std::vector<std::string>& fileNames, const std::string& configFile);
    00050     virtual ~GribCDMReader();
    00051     virtual boost::shared_ptr<Data> getDataSlice(const std::string& varName, size_t unLimDimPos) throw(CDMException);
    00052
    00053 private:
    00054     std::string configFile_;
    00055     std::vector<GribFileMessage> indices_;
    00056     boost::shared_ptr<XMLDoc> doc_;
    00057     std::string xDimName_;
    00058     std::string yDimName_;
    00059     std::string timeDimName_;
    00060     // store ptimes of all times
    00061     std::vector<boost::posix_time::ptime> times_;
    00062     // store level parameters of level-ids: edition, level-type, level-no
    00063     std::map<std::string, std::vector<std::vector<long> > > levels_;
    00071     std::map<std::string, boost::shared_ptr<ReplaceStringObject> > templateReplacementAttributes_;
    00075     std::map<std::string, std::vector<GribFileMessage> > varName2gribMessages_;
    00076
    00080     void initSelectParameters(const std::string& select);
    00085     xmlNodePtr findVariableXMLNode(const GribFileMessage& msg) const;
    00086     void initAddGlobalAttributes();
    00088     void initLevels(long edition, const std::map<long, std::set<long> >& levelsOfType, std::map<std::string, CDMDimension>& levelDimsOfType);
    00089     std::map<std::string, CDMDimension> initAddLevelDimensions();
    00090     void initAddTimeDimension();
    00091     void initAddProjection(std::string& projName, std::string& coordinates);
    00092     void initAddVariables(const std::string& projName, const std::string& coordinates, const std::map<std::string, CDMDimension>& levelDims);
    00093
    00094 };
    00095
    00096
    00097 }
    00098
    00099 #endif /* GRIBCDMREADER_H_ */