00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef ATMODATA_FILE_FORMAT_HXX
00026
00027 namespace AtmoData
00028 {
00029
00031 class FormatCSV: public Format
00032 {
00033
00034 protected:
00035
00036 public:
00037 FormatCSV() throw();
00038 ~FormatCSV() throw();
00039
00040
00041
00042 template<class TD, int N, class TG,
00043 class TS, class TGS>
00044 void Read(string FileName, Data<TD, N, TG>& D,
00045 Data<TS, 1, TGS>& S) const;
00046 template<class TD, int N, class TG,
00047 class TS, class TGS>
00048 void Read(ifstream& FileStream, Data<TD, N, TG>& D,
00049 Data<TS, 1, TGS>& S) const;
00050
00051
00052
00053 template<class TA, int N,
00054 class TS, class TGS>
00055 void Read(string FileName, Array<TA, N>& A,
00056 Data<TS, 1, TGS>& S) const;
00057 template<class TA, int N,
00058 class TS, class TGS>
00059 void Read(ifstream& FileStream, Array<TA, N>& A,
00060 Data<TS, 1, TGS>& S) const;
00061
00062 };
00063
00065 template<class T>
00066 class FormatECMWF: public Format
00067 {
00068
00069 protected:
00071 int date_;
00072
00073 public:
00074 FormatECMWF() throw();
00075 FormatECMWF(int date) throw();
00076 ~FormatECMWF() throw();
00077
00078 void SetDate(int date);
00079 int GetDate() const;
00080
00081
00082
00083 template<class TD, int N, class TG>
00084 void Read(string FileName, Data<TD, N, TG>& D) const;
00085 template<class TD, int N, class TG>
00086 void Read(ifstream& FileStream, Data<TD, N, TG>& D) const;
00087
00088
00089
00090 template<class TA, int N>
00091 void Read(string FileName, Array<TA, N>& A) const;
00092 template<int N>
00093 void Read(ifstream& FileStream, Array<T, N>& A) const;
00094 template<class TA, int N>
00095 void Read(ifstream& FileStream, Array<TA, N>& A) const;
00096
00097 };
00098
00099
00100 class MM5SubHeader;
00101
00103 class FormatMM5: public Format
00104 {
00105
00106 protected:
00107
00108 public:
00109 FormatMM5() throw();
00110 ~FormatMM5() throw();
00111
00112
00113 int ReadFlag(ifstream& FileStream) const;
00114
00115
00116 void ReadBigHeader(string FileName,
00117 Array<int, 2>& BHI, Array<float, 2>& BHR,
00118 Array<string, 2>& BHIC, Array<string, 2>& BHRC) const;
00119 void ReadBigHeader(ifstream& FileStream,
00120 Array<int, 2>& BHI, Array<float, 2>& BHR,
00121 Array<string, 2>& BHIC, Array<string, 2>& BHRC) const;
00122 void ReadBigHeader(ifstream& FileStream) const;
00123
00124
00125 void ReadSubHeader(ifstream& FileStream, MM5SubHeader& SH) const;
00126 void ReadSubHeader(ifstream& FileStream) const;
00127
00128
00129 template <int N, class TG>
00130 void ReadWholeField(string FileName, string FieldName,
00131 Data<float, N, TG>& A) const;
00132 template <int N>
00133 void ReadWholeField(string FileName, string FieldName,
00134 Array<float, N>& A) const;
00135 template <int N, class TG>
00136 void ReadWholeField(ifstream& FileStream, string FieldName,
00137 Data<float, N, TG>& A) const;
00138 template <int N>
00139 void ReadWholeField(ifstream& FileStream, string FieldName,
00140 Array<float, N>& A) const;
00141 template <int N>
00142 void ReadField(ifstream& FileStream, bool cross,
00143 Array<float, N>& A) const;
00144 template <int N, class TG>
00145 void ReadField(ifstream& FileStream, Data<float, N, TG>& A) const;
00146 template <int N>
00147 void ReadField(ifstream& FileStream, MM5SubHeader& SH,
00148 Array<float, N>& A) const;
00149 template <int N>
00150 void ReadField(ifstream& FileStream, Array<float, N>& A) const;
00151 void ReadField(ifstream& FileStream) const;
00152
00153 };
00154
00156 class MM5SubHeader
00157 {
00158
00159 public:
00161 int ndim;
00163 Array<int, 1> start_index;
00165 Array<int, 1> end_index;
00167 float xtime;
00169 string staggering;
00171 string ordering;
00173 string current_date;
00175 string name;
00177 string unit;
00179 string description;
00180
00181 public:
00182 MM5SubHeader() throw();
00183 MM5SubHeader(const MM5SubHeader&) throw();
00184 ~MM5SubHeader() throw();
00185
00186 void Init();
00187 MM5SubHeader& operator=(MM5SubHeader&);
00188 string GetCurrentDate();
00189
00190 };
00191
00192 }
00193
00194
00195 #define ATMODATA_FILE_FORMAT_HXX
00196 #endif