10 string version =
"$Id: modelcorr.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
19 <<
" This is modelcorr: Calculate 'correlation' of seismic and MT model"
22 <<
" Input files are assumed to be have the name inputbase+_rec.mod and inputbase+_mt.mod"
24 cout <<
" for seismic and MT models, respectively. " << endl;
25 cout <<
" This is Version: " <<
version << endl << endl;
27 cout <<
"Inputbase: ";
29 SeismicModel.
ReadModel(inputbase +
"_rec.mod");
34 trealdata mtdepth(mtthickness.size()),
35 seismicdepth(seismicthickness.size());
38 partial_sum(mtthickness.begin(), mtthickness.end(), mtdepth.begin());
39 partial_sum(seismicthickness.begin(), seismicthickness.end(),
40 seismicdepth.begin());
41 mtthickness.back() += 10000.0;
42 seismicthickness.back() += 10000.0;
43 bool finished =
false;
45 size_t seismicindex = 0;
46 const double depththreshold = 0.05;
47 double mtdifferencemeasure = 0.0;
48 double seismicdifferencemeasure = 0.0;
50 int seismicinterfaces = 0;
51 int corrinterfaces = 0;
54 double reldepthdiff = (mtdepth.at(mtindex) - seismicdepth.at(
55 seismicindex)) / min(mtdepth.at(mtindex), seismicdepth.at(
57 if (reldepthdiff > depththreshold && seismicindex < svelocity.size()
60 seismicdifferencemeasure += abs(svelocity.at(seismicindex)
61 - svelocity.at(seismicindex + 1));
65 else if (reldepthdiff < -depththreshold && mtindex < resistivity.size()
68 mtdifferencemeasure += abs(resistivity.at(mtindex)
69 - resistivity.at(mtindex + 1));
79 if (mtindex >= resistivity.size() || seismicindex >= svelocity.size())
84 cout <<
"Seismic depths: ";
85 copy(seismicdepth.begin(), seismicdepth.end(), ostream_iterator<double> (
88 cout <<
"MT depths: ";
89 copy(mtdepth.begin(), mtdepth.end(), ostream_iterator<double> (cout,
" "));
91 cout <<
"MT difference: " << mtdifferencemeasure <<
" Seismic difference: "
92 << seismicdifferencemeasure << endl;
93 cout <<
"MT only interfaces: " << mtinterfaces
94 <<
" Seismic only interfaces: " << seismicinterfaces
95 <<
" Common interfaces: " << corrinterfaces << endl;
virtual void ReadModel(const std::string filename)
Read the model in its native format from a file.
void ReadModel(std::string filename)
Read the model from a file.
The class SeismicModel is the base class for some of the model format for seismic codes...
const trealdata & GetSVelocity() const
Read-only access to the vector of S-velocities in km/s in each layer.
const trealdata & GetThicknesses()
Read only access to the vector of layer thicknesses for the 1D model from top to bottom in km...
Calculate synthetic MT data for a 1D model using Cagniard's algorithm.
const trealdata & GetResistivities()
Read only access to the vector of resistivities for the 1D model from top to bottom in Ohmm...
This class stores and writes model for the respktn 1D seismic code that we use for receiver function ...
const trealdata & GetThickness() const
Read-only access to the vector of thicknesses in km in each layer.