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

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

# include/fimex/Felt_File2.h

Go to the documentation of this file.

    00001 /*
    00002  * Fimex
    00003  *
    00004  * (C) Copyright 2008, 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
    00024 #ifndef FELT_FILE2_H_
    00025 #define FELT_FILE2_H_
    00026
    00027 #include <map>
    00028 #include <vector>
    00029 #include <string>
    00030 #include <boost/shared_ptr.hpp>
    00031 #include <boost/shared_array.hpp>
    00032 #include "fimex/Data.h"
    00033 #include "fimex/Felt_Types.h"
    00034 #include "fimex/Felt_File_Error.h"
    00035 #include "fimex/FeltParameters.h"
    00036 #include "fimex/Logger.h"
    00037 #include "felt/FeltTypes.h"
    00038
    00039 namespace MetNoFelt {
    00040
    00041 class Felt_Array2; // forward decl.
    00042
    00044
    00049 class Felt_File2
    00050 {
    00051 public:
    00053
    00056         Felt_File2() {}
    00061         explicit Felt_File2(const std::string& filename) throw(Felt_File_Error);
    00068         explicit Felt_File2(const std::string& filename, const std::vector<std::string>& dianaParamList, const std::map<std::string, std::string>& options) throw(Felt_File_Error);
    00069         virtual ~Felt_File2();
    00070         //float* getData(const string& compName);
    00071
    00073
    00076         const boost::shared_ptr<Felt_Array2> getFeltArray(const std::string& compName) const throw(Felt_File_Error);
    00078
    00085         boost::shared_ptr<MetNoFimex::Data> getScaledDataSlice(boost::shared_ptr<Felt_Array2> feltArray, const boost::posix_time::ptime time, const LevelPair level) throw(Felt_File_Error);
    00086
    00090         std::vector<boost::shared_ptr<Felt_Array2> > listFeltArrays() const;
    00091
    00096         //std::map<short, std::vector<short> > getFeltLevels() const;
    00101         std::map<short, std::vector<LevelPair> > getFeltLevelPairs() const;
    00102         const std::map<LevelPair, int>& getHybridLevels() const {return hybridLevels_;}
    00104         std::vector<boost::posix_time::ptime> getFeltTimes() const;
    00110         boost::shared_ptr<boost::posix_time::ptime> getUniqueReferenceTime() const;
    00112         int getNX() const;
    00114         int getNY() const;
    00116         boost::shared_ptr<MetNoFimex::Data> getXData() const throw(Felt_File_Error);
    00118         boost::shared_ptr<MetNoFimex::Data> getYData() const throw(Felt_File_Error);
    00119
    00123     int getGridType() const throw(Felt_File_Error);
    00125         boost::shared_ptr<felt::FeltGridDefinition> getGridDefinition() const throw(Felt_File_Error);
    00126
    00127 private:
    00128     std::string filename_;
    00129     boost::shared_ptr<felt::FeltFile> feltFile_;
    00130     std::map<std::string, boost::shared_ptr<Felt_Array2> > feltArrayMap_;
    00131     FeltParameters feltParameters;
    00132     std::map<LevelPair, int> hybridLevels_; // only set for files with idx[10] = 11
    00133     boost::array<float, 6> gridParameterDelta_; // allowed deviation between two grids
    00134
    00135     bool findOrCreateFeltArray(const boost::shared_ptr<felt::FeltField>);
    00137     void init(const std::map<std::string, std::string>& options) throw(Felt_File_Error);
    00139     void setOptions(const std::map<std::string, std::string>& options);
    00140
    00141
    00142 };
    00143
    00144
    00145 } // end namespace MetNoFelt
    00146 #endif /*FELT_FILE2_H_*/