13 #include <boost/function.hpp>
20 using namespace gplib;
23 boost::function<
double(
const MTTensor*)> datafunc, boost::function<
double(
26 ofstream outfile(filename.c_str());
27 const size_t ndata = Data.
GetMTData().size();
28 for (
size_t i = 0; i < ndata; ++i)
30 outfile << setw(15) << setfill(
' ') << setprecision(4) << 1. / Data.
at(
32 outfile << setw(15) << setfill(
' ') << setprecision(4) << datafunc(
34 outfile << setw(15) << setfill(
' ') << setprecision(4) << errfunc(
39 int main(
int argc,
char *argv[])
41 string version =
"$Id: plotmtt.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
43 cout <<
"Program " << version << endl;
45 <<
"Write out impedance phase and apparent resistivity for plotting. "
48 <<
"Will create 8 files starting with Infilename and endings r** for apparent resistivity components "
50 cout <<
" and p** for phase components." << endl << endl;
59 infilename = AskFilename(
"Infilename: ");
62 WriteToFile(infilename +
".rxx", &MTTensor::GetRhoxx, &MTTensor::GetdRhoxx,
64 WriteToFile(infilename +
".rxy", &MTTensor::GetRhoxy, &MTTensor::GetdRhoxy,
66 WriteToFile(infilename +
".ryx", &MTTensor::GetRhoyx, &MTTensor::GetdRhoyx,
68 WriteToFile(infilename +
".ryy", &MTTensor::GetRhoyy, &MTTensor::GetdRhoyy,
70 WriteToFile(infilename +
".pxx", &MTTensor::GetPhi90xx,
71 &MTTensor::GetdPhixx, Data);
72 WriteToFile(infilename +
".pxy", &MTTensor::GetPhi90xy,
73 &MTTensor::GetdPhixy, Data);
74 WriteToFile(infilename +
".pyx", &MTTensor::GetPhi90yx,
75 &MTTensor::GetdPhiyx, Data);
76 WriteToFile(infilename +
".pyy", &MTTensor::GetPhi90yy,
77 &MTTensor::GetdPhiyy, Data);
78 WriteToFile(infilename +
".rberd", &MTTensor::GetRhoBerd,
79 &MTTensor::GetdRhoBerd, Data);
80 WriteToFile(infilename +
".pberd", &MTTensor::GetPhi90Berd,
81 &MTTensor::GetdPhi90Berd, Data);
const MTTensor & at(const unsigned int i) const
direct acces to a tensor at a given index
virtual void GetData(const std::string filename)
read in data from file, determines format by ending
double GetFrequency() const
Get the frequency for the impedance.
The class MTStation is used to store the transfer functions and related information for a MT-site...
void WriteToFile(string filename, boost::function< double(const MTTensor *)> datafunc, boost::function< double(const MTTensor *)> errfunc, const MTStation &Data)
Stores MT-Tensor components at a single frequency, calculates derived quantities. ...
const std::vector< MTTensor > & GetMTData() const
Get the full vector of Tensor elements read only.