9 int main(
int argc,
char* argv[])
11 string version =
"$Id: keepcommon.cpp 1886 2014-10-29 12:38:46Z mmoorkamp $";
13 cout <<
"Program " << version << endl;
14 cout <<
" Read in several files with MT tensor data" << endl;
15 cout <<
" and keep the common frequencies. The files will be written in" << endl;
17 <<
" .mtt format. If the input files were in that format they will be overwritten"
24 std::string infilename;
33 infilename = AskFilename(
"Station Filename: ");
37 const size_t nstats = MTSites.
GetList().size();
41 std::cout <<
"Frequency matrix \n" << std::endl;
42 std::cout << std::setw(12) <<
"Filename ";
45 std::cout << std::setw(10) << freq;
47 std::cout << std::endl;
50 const double tolerance = 0.05;
51 for (
size_t i = 0; i < nstats; ++i)
54 std::cout << std::setw(10) << MTSites.
at(i).
GetName();
56 std::vector<int> havefreq(nfreq, 0);
58 for (
size_t j = 0; j < nfreq; ++j)
60 bool foundfrequency =
false;
66 while ((foundfrequency ==
false)
71 foundfrequency =
true;
75 havefreq.at(j) = foundfrequency;
79 for (
int tick : havefreq)
81 std::cout << std::setw(10) << tick;
83 std::cout << std::endl;
88 for (
size_t i = 0; i < nstats; ++i)
93 for (
int j = 0; j < nfreq; ++j)
109 cerr << e.what() << endl;
MTStation & at(int loc)
Get a reference to a site at a given index.
int main(int argc, char *argv[])
MTStationList holds a number of MTSites, usually associated with a single project, line, etc.
tStationList & GetList()
Access to the complete vector of Stations.
void WriteAsMtt(const std::string filename)
Write data in goettingen .mtt format.
const std::vector< tindexvector > & GetComFreqIndices()
Get a vector that for each site contains the indices to the common frequencies.
void GetData(const std::string filename)
Read a list of filenames and the associated data in those files to fill the list. ...
trealdata GetFrequencies() const
return the available frequencies in a single vector
void SetFrequencies(const trealdata &freqs)
Set the frequencies of the tensor elements, invalidates the previously stored impedance data...
The basic exception class for all errors that arise in gplib.