rfvel.cpp
Go to the documentation of this file.00001 #include "RFVelCalc.h"
00002 #include "CalcRecConf.h"
00003 #include "SeismicDataComp.h"
00004 #include "FatalException.h"
00005 #include <iostream>
00006 #include <fstream>
00007 #include <string>
00008 #include "Util.h"
00009
00010 using namespace std;
00011 using namespace gplib;
00012
00013 string version = "$Id: rfvel.cpp 1839 2010-03-05 17:04:34Z mmoorkamp $";
00014
00015 int main()
00016 {
00017 cout
00018 << " This is rfvel: Calculate absolute velocties from receiver functions"
00019 << endl;
00020 cout << " Reads in radial and vertical components in SAC format" << endl;
00021 cout
00022 << " Writes a file with ending .vel containing apparent velocities and corresponding periods"
00023 << endl;
00024 cout
00025 << " The settings for the calculation method, omega, sigma and shift are taken from calcrec.conf"
00026 << endl;
00027 cout << " This is Version: " << version << endl << endl;
00028 string modelfilename;
00029
00030 CalcRecConf Config;
00031 SeismicDataComp Radial, Vertical;
00032 string outfilename;
00033 double slowness;
00034 try
00035 {
00036 string radfilename, verfilename;
00037
00038 Config.GetData("calcrec.conf");
00039
00040 RecCalc::trfmethod rfmethod = RecCalc::specdiv;
00041 if (Config.recmethod == "iterdecon")
00042 {
00043 rfmethod = RecCalc::iterdecon;
00044 }
00045
00046 radfilename = AskFilename("Radial Component: ");
00047 verfilename = AskFilename("Vertical Component: ");
00048 outfilename = radfilename + ".vel";
00049
00050 cout << "Slowness in s/km: ";
00051 cin >> slowness;
00052
00053 Radial.ReadData(radfilename);
00054 Vertical.ReadData(verfilename);
00055 ofstream outfile(outfilename.c_str());
00056 RFVelCalc RFVel(Config.sigma, Config.cc, rfmethod);
00057
00058 ttsdata AppVel;
00059
00060 RFVel.CalcRFVel(slowness, Radial, Vertical, AppVel);
00061 RFVel.WriteVelocities(outfilename);
00062 } catch (FatalException &e)
00063 {
00064 cerr << e.what() << endl;
00065 return -1;
00066 }
00067 }