GPLIB++
SeismicDataComp.h
Go to the documentation of this file.
1 #ifndef CSEISMICDATACOMP_H
2 #define CSEISMICDATACOMP_H
3 #include <string>
4 #include "types.h"
5 #include "TimeSeriesComponent.h"
6 
7 namespace gplib
8  {
9  /** \addtogroup seistools Seismic data analysis and modeling */
10  /* @{ */
11 
13  {
14  public:
16  {
18  };
19  double GetB() const
20  {
21  return b;
22  }
23  void SetB(const double theb)
24  {
25  b = theb;
26  }
28  {
29  return dataformat;
30  }
31  //! Return the latitude of the station
32  double GetStLa() const
33  {
34  return stla;
35  }
36  //! Set the latitude of the station
37  void SetStLa(const double lat)
38  {
39  stla = lat;
40  }
41  //! Get the longitude of the station
42  double GetStLo() const
43  {
44  return stlo;
45  }
46  //! Set the longitude of the station
47  void SetStLo(const double lon)
48  {
49  stla = lon;
50  }
51  //! Get the elevation of the station in m
52  double GetStEl() const
53  {
54  return stel;
55  }
56  //! Get the depth of the station below the ground in m
57  double GetStDp() const
58  {
59  return stdp;
60  }
61  //! Get the latitude of the event
62  double GetEvLa() const
63  {
64  return evla;
65  }
66  //! Get the longitude of the event
67  double GetEvLo() const
68  {
69  return evlo;
70  }
71  //! Get the elevation of the event
72  double GetEvEl() const
73  {
74  return evel;
75  }
76  //! Get the depth of the event
77  double GetEvDp() const
78  {
79  return evdp;
80  }
81  //! Get the magnitude of the event
82  double GetMag() const
83  {
84  return mag;
85  }
86  //! Get the distance between event and station
87  double GetDist() const
88  {
89  return dist;
90  }
91  //! Get the azimuth of the event
92  double GetAz() const
93  {
94  return az;
95  }
96  //! Get the back-azimuth of the event
97  double GetBaz() const
98  {
99  return baz;
100  }
101  //! Get the distance between station and event along a great circle
102  double GetGcarc() const
103  {
104  return gcarc;
105  }
106  //! Read in data from a file, as we cannot determine the type from the ending we have to provide it
107  int
108  ReadData(const std::string &filename, tseismicdataformat format = sac);
109  //! Write the data in sac binary format
110  int WriteAsSac(const std::string &filename) const;
111  //! Write the data in plain ascii format
112  int WriteAsAscii(const std::string &filename) const;
113  //! Write the data in the format it was read in and with the same filename
114  int WriteBack() const;
115  //! Copy the information in the header from another object
116  void CopyHeader(const SeismicDataComp& source);
117  SeismicDataComp(const std::string &filename, tseismicdataformat format =
118  sac);
119  SeismicDataComp();
120  virtual ~SeismicDataComp();
121  virtual SeismicDataComp& operator=(const SeismicDataComp& source);
122  private:
123  double stla;
124  double stlo;
125  double stel;
126  double stdp;
127  double evla;
128  double evlo;
129  double evel;
130  double evdp;
131  double mag;
132  double dist;
133  double az;
134  double baz;
135  double gcarc;
136  //std::string name;
137  double b; // Time Shift between origin time of eq and beginning of data
138  //ttsdata Data;
139  tseismicdataformat dataformat;
140  void ReadSac(const std::string &filename);
141  void ReadHeaderAscii(const std::string &filename);
142  void ReadSKS(const std::string &filename);
143  void ReadAscii(const std::string &filename);
144  };
145  /* @} */
146  }
147 #endif // CSEISMICDATACOMP_H
int ReadData(const std::string &filename, tseismicdataformat format=sac)
Read in data from a file, as we cannot determine the type from the ending we have to provide it...
double GetStLa() const
Return the latitude of the station.
double GetStDp() const
Get the depth of the station below the ground in m.
double GetDist() const
Get the distance between event and station.
double GetEvDp() const
Get the depth of the event.
double GetEvLo() const
Get the longitude of the event.
double GetB() const
double GetEvEl() const
Get the elevation of the event.
double GetGcarc() const
Get the distance between station and event along a great circle.
double GetBaz() const
Get the back-azimuth of the event.
void SetStLo(const double lon)
Set the longitude of the station.
double GetEvLa() const
Get the latitude of the event.
void CopyHeader(const SeismicDataComp &source)
Copy the information in the header from another object.
TimeSeriesComponent is the base storage class for all types of time series data.
double GetStEl() const
Get the elevation of the station in m.
void SetB(const double theb)
double GetMag() const
Get the magnitude of the event.
double GetAz() const
Get the azimuth of the event.
double GetStLo() const
Get the longitude of the station.
int WriteBack() const
Write the data in the format it was read in and with the same filename.
void SetStLa(const double lat)
Set the latitude of the station.
virtual SeismicDataComp & operator=(const SeismicDataComp &source)
tseismicdataformat GetFormat()
int WriteAsSac(const std::string &filename) const
Write the data in sac binary format.
int WriteAsAscii(const std::string &filename) const
Write the data in plain ascii format.