00001 #ifndef CMTSTATION_H
00002 #define CMTSTATION_H
00003
00004 #include "MTTensor.h"
00005 #include "MagneticTF.h"
00006 #include "types.h"
00007 #include <string>
00008 #include <boost/function.hpp>
00009
00010
00011
00012
00013
00014 class MTStation
00015 {
00016 public:
00017 enum tmtdataformat
00018 { unknown, mtt, j, edi, pek};
00019 private:
00020
00021 double latitude;
00022
00023 double longitude;
00024
00025 double elevation;
00026
00027 std::string name;
00028
00029 double azimuth;
00030
00031 std::vector<MTTensor> MTData;
00032
00033 std::vector<MagneticTF> TFData;
00034 void DoRotate(const int i, const double angle);
00035
00036 void InitialSetup();
00037
00038 tmtdataformat dataformat;
00039
00040 void WriteMtt(const std::string filename);
00041
00042 void ReadEdi(const std::string filename);
00043
00044 void ReadJ(const std::string filename);
00045
00046 void ReadMtt(const std::string filename);
00047
00048 void ReadPek1D(const std::string filename);
00049
00050 void WriteJBlock(boost::function<std::complex<double> (const MTTensor*)> Comp, boost::function<double (const MTTensor*)> Err, std::ofstream &outfile, const double convfactor);
00051 protected:
00052
00053 void Update();
00054
00055
00056 void Assign(const int nfreq);
00057 public:
00058
00059 void AssignAll(const int nfreq);
00060
00061
00062 void Rotate(const double rotangle);
00063
00064 void Rotate(void);
00065
00066 trealdata GetFrequencies() const;
00067
00068 void SetFrequencies(const trealdata &freqs);
00069
00070 double GetLatitude() const
00071 {
00072 return latitude;
00073 }
00074 void SetLatitude(double lat)
00075 {
00076 latitude = lat;
00077 }
00078 double GetLongitude() const
00079 {
00080 return longitude;
00081 }
00082 void SetLongitude(double lon)
00083 {
00084 longitude = lon;
00085 }
00086 double GetElevation() const
00087 {
00088 return elevation;
00089 }
00090 std::string GetName()
00091 {
00092 return name;
00093 }
00094 double GetAzimuth() const
00095 {
00096 return azimuth;
00097 }
00098 ;
00099
00100 const MTTensor &at(const unsigned int i) const
00101 {
00102 return MTData.at(i);
00103 }
00104
00105 const std::vector<MTTensor> &GetMTData() const
00106 {
00107 return MTData;
00108 }
00109
00110 std::vector<MTTensor> &SetMTData()
00111 {
00112 return MTData;
00113 }
00114
00115 virtual MTStation *clone() const
00116 {
00117 return new MTStation(*this);
00118 }
00119 MTStation& operator=(const MTStation& source);
00120 MTStation();
00121 MTStation(const MTStation &old);
00122 MTStation(const int size);
00123 MTStation(const std::string filename);
00124 virtual ~MTStation();
00125
00126 virtual void GetData(const std::string filename);
00127 virtual void GetData()
00128 {
00129 }
00130
00131 virtual void WriteData(const std::string filename);
00132 friend class C1DMTSynthData;
00133
00134 void WriteAsMtt(const std::string filename);
00135
00136 void WriteAsEdi(const std::string filename);
00137
00138 void WriteAsJ(const std::string filename);
00139
00140 void WriteBack();
00141 };
00142
00143 #endif // CMTSTATION_H