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:
00070 int date_;
00071
00072 public:
00073 FormatECMWF() throw();
00074 FormatECMWF(int date) throw();
00075 ~FormatECMWF() throw();
00076
00077 void SetDate(int date);
00078 int GetDate() const;
00079
00080
00081
00082 template<class TD, int N, class TG>
00083 void Read(string FileName, Data<TD, N, TG>& D) const;
00084 template<class TD, int N, class TG>
00085 void Read(ifstream& FileStream, Data<TD, N, TG>& D) const;
00086
00087
00088
00089 template<class TA, int N>
00090 void Read(string FileName, Array<TA, N>& A) const;
00091 template<int N>
00092 void Read(ifstream& FileStream, Array<T, N>& A) const;
00093 template<class TA, int N>
00094 void Read(ifstream& FileStream, Array<TA, N>& A) const;
00095
00096 };
00097
00098
00099 class MM5SubHeader;
00100
00102 class FormatMM5: public Format
00103 {
00104
00105 protected:
00106
00107 public:
00108 FormatMM5() throw();
00109 ~FormatMM5() throw();
00110
00111
00112 int ReadFlag(ifstream& FileStream) const;
00113
00114
00115 void ReadBigHeader(string FileName,
00116 Array<int, 2>& BHI, Array<float, 2>& BHR,
00117 Array<string, 2>& BHIC, Array<string, 2>& BHRC) const;
00118 void ReadBigHeader(ifstream& FileStream,
00119 Array<int, 2>& BHI, Array<float, 2>& BHR,
00120 Array<string, 2>& BHIC, Array<string, 2>& BHRC) const;
00121 void ReadBigHeader(ifstream& FileStream) const;
00122
00123
00124 void ReadSubHeader(ifstream& FileStream, MM5SubHeader& SH) const;
00125 void ReadSubHeader(ifstream& FileStream) const;
00126
00127
00128 template <int N, class TG>
00129 void ReadWholeField(string FileName, string FieldName,
00130 Data<float, N, TG>& A) const;
00131 template <int N>
00132 void ReadWholeField(string FileName, string FieldName,
00133 Array<float, N>& A) const;
00134 template <int N, class TG>
00135 void ReadWholeField(ifstream& FileStream, string FieldName,
00136 Data<float, N, TG>& A) const;
00137 template <int N>
00138 void ReadWholeField(ifstream& FileStream, string FieldName,
00139 Array<float, N>& A) const;
00140 template <int N>
00141 void ReadField(ifstream& FileStream, bool cross,
00142 Array<float, N>& A) const;
00143 template <int N, class TG>
00144 void ReadField(ifstream& FileStream, Data<float, N, TG>& A) const;
00145 template <int N>
00146 void ReadField(ifstream& FileStream, MM5SubHeader& SH,
00147 Array<float, N>& A) const;
00148 template <int N>
00149 void ReadField(ifstream& FileStream, Array<float, N>& A) const;
00150 void ReadField(ifstream& FileStream) const;
00151
00152 };
00153
00155 class MM5SubHeader
00156 {
00157
00158 public:
00159 int ndim;
00160 Array<int, 1> start_index;
00161 Array<int, 1> end_index;
00162 float xtime;
00163 string staggering;
00164 string ordering;
00165 string current_date;
00166 string name;
00167 string unit;
00168 string description;
00169
00170 public:
00171 MM5SubHeader() throw();
00172 MM5SubHeader(const MM5SubHeader&) throw();
00173 ~MM5SubHeader() throw();
00174
00175 void Init();
00176 MM5SubHeader& operator=(MM5SubHeader&);
00177
00178 };
00179
00180 }
00181
00182
00183 #define ATMODATA_FILE_FORMAT_HXX
00184 #endif