17 using namespace gplib;
19 string version =
"$Id: magmean.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
21 int main(
int argc,
char *argv[])
24 unsigned int nfiles = 0;
27 <<
"This is magmean: Calculate the mean magnetic time series from several stations"
29 cout <<
"Usage: magmean" << endl;
30 cout <<
"There are no command line arguments, only interactive mode"
32 cout <<
"This is Version: " <<
version << endl << endl;
33 cout <<
"How many stations: ";
36 vector<TimeSeriesData> Sites;
37 for (
unsigned int i = 0; i < nfiles; ++i)
40 std::string prompt =
"Site File " + stringify(i+1) +
" :";
42 infilename = AskFilename(prompt);
44 Sites.push_back(CurrSite);
46 cout <<
"Calculating mean ... " << endl;
48 for (
unsigned int i = 1; i < nfiles; ++i)
50 Sites.at(0).GetData().GetHx() += Sites.at(i).GetData().GetHx();
51 Sites.at(0).GetData().GetHy() += Sites.at(i).GetData().GetHy();
52 Sites.at(0).GetData().GetHz() += Sites.at(i).GetData().GetHz();
54 Sites.at(0).GetData().GetHx() *= 1./nfiles;
55 Sites.at(0).GetData().GetHy() *= 1./nfiles;
56 Sites.at(0).GetData().GetHz() *= 1./nfiles;
57 Sites.at(0).WriteAsBirrp(
"magmean.out");
58 cout <<
"... done " << endl;
TimeSeries & GetData()
return a reference to the actual object stored in the pointer
TimeSeriesData stores a pointer to the different components of magnetotelluric data and provides func...