GPLIB++
datarec_multi.cpp
Go to the documentation of this file.
1 #include "CalcRecConf.h"
2 #include "SeismicStationList.h"
3 #include "FatalException.h"
4 #include "MultiRecCalc.h"
5 #include "Util.h"
6 #include <iostream>
7 #include <fstream>
8 #include <string>
9 #include <vector>
10 
11 using namespace std;
12 using namespace gplib;
13 
14 string version = "$Id: datarec_multi.cpp 1839 2010-03-05 17:04:34Z mmoorkamp $";
15 
16 int main()
17  {
18  cout
19  << " This is datarec_multi: Calculate receiver functions simultaneously for several events"
20  << endl; // write some info
21  cout
22  << " Reads in two lists of files with radial and vertical component file names, respectively"
23  << endl;
24  cout << " Outputs a file multi.rec " << endl;
25  cout << " Some behaviour can be configured with the file calcrec.conf"
26  << endl;
27  cout << " This is Version: " << version << endl << endl;
28 
29  CalcRecConf Config;
30  SeismicDataComp CurrRadial, CurrVertical;
31  SeismicStationList Radial, Vertical;
32  string outfilename = "multi.rec";
33  try
34  {
35  Config.GetData("calcrec.conf");
36  std::string radlistname = AskFilename(
37  "File with list of radial filenames: ");
38  std::string verlistname = AskFilename(
39  "File with list of vertical filenames: ");
40 
41  Radial.ReadList(radlistname);
42  Vertical.ReadList(verlistname);
43 
44  MultiRecCalc Receiver(Config.shift, Config.sigma, Config.cc);
45  SeismicDataComp RecFunc;
46  Receiver.CalcRecData(Radial.GetList(), Vertical.GetList(), RecFunc);
47 
48  RecFunc.WriteAsSac(outfilename);
49  } catch (FatalException &e)
50  {
51  cerr << e.what() << endl; // if something fails print error
52  return -1; // and stop execution
53  }
54  }
tseiscompvector & GetList()
Return the content of the list for manipulation.
int main()
Manages a collection of seismic traces, mainly provides functionality to read in data specified in a ...
This class implements the multi-site receiver function calculation in the frequency domain as suggest...
Definition: MultiRecCalc.h:12
void GetData(std::string filename)
Definition: CalcRecConf.cpp:32
string version
void ReadList(const std::string filename)
read in a file with names and optionally coordinates
void CalcRecData(const SeismicStationList::tseiscompvector &RadComp, const SeismicStationList::tseiscompvector &VerComp, SeismicDataComp &Receiver)
Calculate the receiver function by spectral division.
int WriteAsSac(const std::string &filename) const
Write the data in sac binary format.
The basic exception class for all errors that arise in gplib.