GPLIB++
goe2j.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <iterator>
3 #include "MTStationList.h"
4 #include "Util.h"
5 
6 using namespace std;
7 using namespace gplib;
8 
9 int main(int argc, char* argv[])
10  {
11  string version = "$Id: goe2j.cpp 1842 2010-04-09 14:30:17Z mmoorkamp $";
12  cout << endl << endl;
13  cout << "Program " << version << endl;
14  cout << " Convert edi files to .mtt and .j format." << endl;
15  cout
16  << " Input is a file that contains the names of the edi files to convert."
17  << endl;
18  cout << " For each file two new files in .j and .mtt format are written."
19  << endl;
20  cout << endl << endl;
21  MTStationList MTSites;
22  string infilename;
23  if (argc > 1)
24  {
25  infilename = argv[1];
26  }
27  else
28  {
29  infilename = AskFilename("Input Filename: ");
30  }
31 
32  MTSites.GetData(infilename);
33  for (unsigned int i = 0; i < MTSites.GetList().size(); ++i)
34  {
35  cout << "Writing site " << MTSites.GetList().at(i).GetName();
36  MTSites.at(i).WriteAsMtt(MTSites.GetList().at(i).GetName());
37  MTSites.at(i).WriteAsJ(MTSites.GetList().at(i).GetName());
38  cout << " ... done" << endl;
39  }
40  if (!MTSites.GetList().empty())
41  {
42  cout << "Common frequencies: ";
43  copy(MTSites.GetCommonFrequencies().begin(),
44  MTSites.GetCommonFrequencies().end(), ostream_iterator<double> (
45  cout, " "));
46  for (unsigned int j = 0; j < MTSites.GetCommonFrequencies().size(); ++j)
47  cout << MTSites.GetCommonFrequencies().at(j) << " ";
48  cout << endl;
49  MTSites.WriteList(infilename + "_mtt");
50  }
51  else
52  {
53  cout << "Could not find any files !" << std::endl;
54  }
55  }
56 
MTStation & at(int loc)
Get a reference to a site at a given index.
void WriteList(const std::string filename="station.list")
Write the names of the sites in the current list to a file.
void WriteAsJ(const std::string filename)
Write data to j-file.
Definition: MTStation.cpp:714
const trealdata & GetCommonFrequencies()
Get a vector with frequencies that are common to all sites.
Definition: MTStationList.h:47
MTStationList holds a number of MTSites, usually associated with a single project, line, etc.
Definition: MTStationList.h:16
tStationList & GetList()
Access to the complete vector of Stations.
Definition: MTStationList.h:31
void WriteAsMtt(const std::string filename)
Write data in goettingen .mtt format.
Definition: MTStation.cpp:681
void GetData(const std::string filename)
Read a list of filenames and the associated data in those files to fill the list. ...
string version
Definition: makeinput.cpp:16
int main(int argc, char *argv[])
Definition: goe2j.cpp:9