GPLIB++
mtu2birrp.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 #include "Util.h"
4 #include "TimeSeriesData.h"
5 #include "FatalException.h"
6 
7 using namespace std;
8 using namespace gplib;
9 
10 string version = "$Id: mtu2birrp.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
11 
12 /*!
13  * \addtogroup UtilProgs Utility Programs
14  *@{
15  * \file
16  * Converts MTU-Format and other MT data into Birrp Ascii format for processing with the birrp code
17  * (basically just 5 ascii columns with the data).
18  */
19 
20 void WriteInfoAndAsk(string &infilename, string &outfilename)
21  {
22  cout << "This is mtu2birrp: Convert Phoenix time series to birrp-ascii"
23  << endl << endl;
24  cout << "Usage: mtu2birrp infilename outfilename" << endl;
25  cout << "Ending .asc will be automatically assigned to outfilename" << endl
26  << endl;
27  cout << "This is Version: " << version << endl << endl;
28  infilename = AskFilename("Input Filename: ");
29  cout << "Birrp-Ascii-Filename without extension: ";
30  cin >> outfilename;
31  }
32 int main(int argc, char *argv[])
33  {
34  string infilename, outfilename;
35  switch (argc)
36  {
37  case 2:
38  infilename = argv[1];
39  outfilename = argv[1];
40  break;
41  case 3:
42  infilename = argv[1];
43  outfilename = argv[2];
44  break;
45  default:
46  WriteInfoAndAsk(infilename, outfilename);
47  break;
48  }
49 
50  TimeSeriesData Data;
51  try
52  {
53  Data.GetData(infilename);
54  Data.WriteAsBirrp(outfilename);
55  } catch (const FatalException &e)
56  {
57  cerr << e.what() << endl;
58  }
59  }
60 /*@}*/
TimeSeries & GetData()
return a reference to the actual object stored in the pointer
int main()
Definition: angleavg.cpp:12
void WriteInfoAndAsk(string &infilename, string &outfilename)
Definition: mtu2birrp.cpp:20
void WriteAsBirrp(std::string filename_base)
Write data to file in ascii format for birrp processing.
TimeSeriesData stores a pointer to the different components of magnetotelluric data and provides func...
string version
Definition: mtu2birrp.cpp:10
The basic exception class for all errors that arise in gplib.