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; // write some info
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         //read the configuration file
00038         Config.GetData("calcrec.conf");
00039         //the default calculation method is spectral division
00040         RecCalc::trfmethod rfmethod = RecCalc::specdiv;
00041         if (Config.recmethod == "iterdecon")
00042           {
00043             rfmethod = RecCalc::iterdecon;
00044           }
00045         //get the names for the radial and vertical component seismograms
00046         radfilename = AskFilename("Radial Component: ");
00047         verfilename = AskFilename("Vertical Component: ");
00048         outfilename = radfilename + ".vel";
00049         //we have to ask for the slowness of the incoming P-wave
00050         cout << "Slowness in s/km: ";
00051         cin >> slowness;
00052         //read in the seismograms
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         //do the calculation and write to a file
00060         RFVel.CalcRFVel(slowness, Radial, Vertical, AppVel);
00061         RFVel.WriteVelocities(outfilename);
00062       } catch (FatalException &e)
00063       {
00064         cerr << e.what() << endl; // if something fails print error
00065         return -1; // and stop execution
00066       }
00067   }

Generated on Tue May 4 16:52:15 2010 for GPLIB++ by  doxygen 1.5.8