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

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

# include/fimex/Felt_Array2.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_ARRAY2_H_
    00025 #define FELT_ARRAY2_H_
    00026 #include <string>
    00027 #include <set>
    00028 #include <vector>
    00029 #include <map>
    00030 #include <boost/array.hpp>
    00031 #include <boost/date_time/posix_time/posix_time_types.hpp>
    00032
    00033 #include <fimex/Felt_Types.h>
    00034 #include "fimex/Felt_File_Error.h"
    00035
    00036 #include "felt/FeltTypes.h"
    00037
    00038 namespace MetNoFelt {
    00039 using namespace std;
    00040
    00041
    00043
    00047 class Felt_Array2
    00048 {
    00049 private:
    00050     // sorted container for level -> field associations
    00051     typedef map<LevelPair, boost::shared_ptr<felt::FeltField>, LevelPairLess> LevelFieldMap;
    00052     // container for all available times and levels (ordered by time and level)
    00053         typedef map<boost::posix_time::ptime, LevelFieldMap > TimeLevelFieldMap;
    00054         string feltArrayName_;
    00055         const boost::shared_ptr<felt::FeltField> defaultField_; // this is also one of the feltFields
    00056     string dataType_;
    00057     double fillValue_;
    00058         TimeLevelFieldMap feltFields_; // main storage for all fields with same information
    00060     Felt_Array2();
    00061     void addField_(const boost::shared_ptr<felt::FeltField> field);
    00062 public:
    00070         explicit Felt_Array2(const string name, const boost::shared_ptr<felt::FeltField> feltField, const string& dataType, double fillValue);
    00071         virtual ~Felt_Array2();
    00076         void addInformationByField(boost::shared_ptr<felt::FeltField> field) throw(Felt_File_Error);
    00077
    00079 //      const boost::array<short, 20>& getDataHeader() const {}
    00080
    00082         const string& getName() const;
    00084         const string& getDatatype() const {return dataType_;}
    00093         int getGrid(boost::posix_time::ptime time, LevelPair levelPair, vector<short>& gridOut) throw(Felt_File_Error);
    00098         int getGridAllowDelta(boost::posix_time::ptime time, LevelPair levelPair, vector<short>& gridOut, const boost::array<float, 6>& gridParameterDelta) throw(Felt_File_Error);
    00100     int getLevelType() const;
    00102         double getFillValue() const {return fillValue_;}
    00103
    00105         vector<boost::posix_time::ptime> getTimes() const;
    00107         vector<boost::posix_time::ptime> getReferenceTimes() const;
    00108
    00112         vector<LevelPair> getLevelPairs() const;
    00117         int getIdent19(boost::posix_time::ptime time, LevelPair levelPair) const throw(Felt_File_Error);
    00118
    00120         int getX() const;
    00122         int getY() const;
    00124         int scaleFactor() const;
    00126         double getScalingFactor() const;
    00127         boost::shared_ptr<felt::FeltGridDefinition> getGridDefinition() const;
    00128         int getGridType() const;
    00130     bool hasTime() const;
    00131     const boost::shared_ptr<felt::FeltField> getField(boost::posix_time::ptime time, LevelPair levelPair) const throw(Felt_File_Error);
    00132 };
    00133
    00134 } // end namespace MetNoFelt
    00135 #endif /*FELT_ARRAY2_H_*/