GPLIB++
printhdr.cpp
Go to the documentation of this file.
1 #include "SeismicDataComp.h"
2 #include "CFatalException.h"
3 #include <iostream>
4 #include <string>
5 #include "Util.h"
6 
7 using namespace std;
8 using namespace gplib;
9 
10 string version = "$Id: printhdr.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
11 
12 int main()
13  {
14  cout << "This is printhdr: Print sac header information" << endl; // write some info
15  cout << " Reads in a file in SAC format and writes header data to stdout"
16  << endl;
17  cout
18  << " Not all header values are displayed, only the ones supported by CSeismicDatacomp"
19  << endl;
20  cout << " This is Version: " << version << endl << endl;
21 
22  string infilename = AskFilename("Input file: ");
23 
24  SeismicDataComp Input;
25 
26  try
27  {
28  Input.ReadData(infilename);
29  } catch (FatalException &e)
30  {
31  cerr << e.what() << endl; // if something fails print error
32  return -1; // and stop execution
33  }
34  cout << "Name: " << Input.GetName() << endl;
35  cout << "StLA: " << Input.GetStLa() << endl;
36  cout << "StLo: " << Input.GetStLo() << endl;
37  cout << "StEl: " << Input.GetStEl() << endl;
38  cout << "StDp: " << Input.GetStDp() << endl;
39  cout << "EvLa: " << Input.GetEvLa() << endl;
40  cout << "EvLo: " << Input.GetEvLo() << endl;
41  cout << "EvEl: " << Input.GetEvEl() << endl;
42  cout << "EvDp: " << Input.GetEvDp() << endl;
43  cout << "Mag: " << Input.GetMag() << endl;
44  cout << "Dist: " << Input.GetDist() << endl;
45  cout << "Az: " << Input.GetAz() << endl;
46  cout << "Baz: " << Input.GetBaz() << endl;
47  cout << "GcArc: " << Input.GetGcarc() << endl;
48  cout << "Dt: " << Input.GetDt() << endl;
49  cout << "B: " << Input.GetB() << endl;
50 
51  }
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.
int main()
Definition: printhdr.cpp:12
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.
double GetEvLa() const
Get the latitude of the event.
string version
Definition: printhdr.cpp:10
double GetStEl() const
Get the elevation of the station in m.
std::string GetName() const
Return name of the component.
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.
double GetDt() const
Return dt in s.
The basic exception class for all errors that arise in gplib.