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 FELT_FILE_H_
00025 #define FELT_FILE_H_
00026
00027 #include <ctime>
00028 #include <map>
00029 #include <vector>
00030 #include <string>
00031 #include <boost/shared_ptr.hpp>
00032 #include <boost/shared_array.hpp>
00033 #include "Data.h"
00034 #include "felt_reader/Felt_Array.h"
00035 #include "felt_reader/Felt_File_Error.h"
00036 #include "felt_reader/FeltParameters.h"
00037
00038 namespace MetNoFelt {
00039
00041
00046 class Felt_File
00047 {
00048 std::string filename;
00049 boost::shared_ptr<int> fdPtr;
00050 std::map<std::string, Felt_Array> feltArrayMap;
00051 FeltParameters feltParameters;
00052
00053 private:
00054 Felt_Array& findOrCreateFeltArray(const boost::array<short, 16>& idx);
00055 std::vector<short> getDataSlice(Felt_Array& fa, boost::array<short, 16>& idx, int fieldSize) throw(Felt_File_Error);
00056 boost::shared_array<short> getHeaderData(Felt_Array& fa, boost::array<short, 16>& idx, int fieldSize) throw(Felt_File_Error);
00058 void init() throw(Felt_File_Error);
00059
00060 public:
00062
00065 Felt_File() {}
00070 explicit Felt_File(const std::string& filename) throw(Felt_File_Error);
00077 explicit Felt_File(const std::string& filename, const std::vector<std::string>& dianaParamList) throw(Felt_File_Error);
00078 virtual ~Felt_File();
00079
00080
00082
00085 Felt_Array& getFeltArray(const std::string& compName) throw(Felt_File_Error);
00087
00092 std::vector<short> getDataSlice(const std::string& compName, const std::time_t time, const short level) throw(Felt_File_Error);
00100 boost::shared_ptr<MetNoFimex::Data> getScaledDataSlice(const std::string& compName, const std::time_t time, const short level, double fillValue) throw(Felt_File_Error);
00101
00105 std::vector<Felt_Array> listFeltArrays();
00106
00111 std::map<short, std::vector<short> > getFeltLevels() const;
00116 std::map<short, std::vector<pair<short,short> > > getFeltLevelPairs() const;
00118 std::vector<time_t> getFeltTimes() const;
00120 int getNX() const;
00122 int getNY() const;
00124 boost::shared_ptr<MetNoFimex::Data> getXData() const throw(Felt_File_Error);
00126 boost::shared_ptr<MetNoFimex::Data> getYData() const throw(Felt_File_Error);
00127
00129 short getGridType() const throw(Felt_File_Error);
00130
00132 const boost::array<float, 6>& getGridParameters() const throw(Felt_File_Error);
00133
00134 };
00135
00136
00137 }
00138 #endif