Commit 1fa6bcb5 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2305
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent a01b8359
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: dccal.cc,v 1.1 2007-06-12 14:05:18 tforb Exp $
* $Id: dccal.cc,v 1.2 2007-06-12 16:58:42 tforb Exp $
* \author Thomas Forbriger
* \date 12/06/2007
*
......@@ -19,11 +19,15 @@
#define DCCAL_VERSION \
"DCCAL V1.0 DC calibration"
#define DCCAL_CVSID \
"$Id: dccal.cc,v 1.1 2007-06-12 14:05:18 tforb Exp $"
"$Id: dccal.cc,v 1.2 2007-06-12 16:58:42 tforb Exp $"
#include <string>
#include <iostream>
#include <fstream>
#include <tfxx/commandline.h>
#include <sffxx.h>
#include <sffostream.h>
#include <datreadxx/readany.h>
using std::cout;
using std::cerr;
......@@ -32,10 +36,37 @@ using std::endl;
// command line options and arguments
struct Options {
bool verbose;
bool writeresfile, writelogfile;
std::string resfilename, logfilename, infilename, tabfilename;
std::string inputformat;
}; // struct Options
// values type to be used for samples
typedef double Tvalue;
// time series
typedef aff::Series<Tvalue> Tseries;
/*======================================================================*/
// here we go with a class to evaluate the calibration
class Results {
double gain;
std::string units;
}; // class Results
class Calibration {
public:
// constructor takes calibration definition from input stream
Calibration(std::istream &is);
private:
}; // class Calibration
/*----------------------------------------------------------------------*/
Calibration::Calibration(std::istream &is)
{
}
/*======================================================================*/
int main(int iargc, char* argv[])
......@@ -45,8 +76,8 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
DCCAL_VERSION "\n"
"usage: dccal [-v] [-r resfile] [-l logfile]" "\n"
" infile tabfile" "\n"
"usage: dccal [-v] [-type t]" "\n"
" infile tabfile resfile logfile" "\n"
" or: dccal --help|-h" "\n"
};
......@@ -57,9 +88,10 @@ int main(int iargc, char* argv[])
"\n"
"infile SFF data file" "\n"
"tabfile ASCII table that defines calibration input" "\n"
"resfile write residuals to resfile" "\n"
"logfile write results to logfile" "\n"
"-v be verbose" "\n"
"-r resfile write residuals to resfile" "\n"
"-l logfile write results to logfile" "\n"
"-type t input file type" "\n"
"\n"
"definition of table file entries:" "\n"
};
......@@ -72,10 +104,8 @@ int main(int iargc, char* argv[])
{"help",arg_no,"-"},
// 1: verbose mode
{"v",arg_no,"-"},
// 2: residual file
{"r",arg_yes,"-"},
// 3: log file
{"l",arg_yes,"-"},
// 2: input format
{"type",arg_yes,"sff"},
{NULL}
};
......@@ -100,15 +130,51 @@ int main(int iargc, char* argv[])
// read command line
Options opt;
opt.verbose=cmdline.optset(1);
opt.writeresfile=cmdline.optset(2);
opt.resfilename=cmdline.string_arg(2);
opt.writelogfile=cmdline.optset(3);
opt.logfilename=cmdline.string_arg(3);
opt.inputformat=cmdline.string_arg(2);
TFXX_assert(cmdline.extra(), "missing input file");
opt.infilename=cmdline.next();
std::string infilename=cmdline.next();
TFXX_assert(cmdline.extra(), "missing table file");
opt.tabfilename=cmdline.next();
std::string tabfilename=cmdline.next();
TFXX_assert(cmdline.extra(), "missing residual file");
std::string resfilename=cmdline.next();
TFXX_assert(cmdline.extra(), "missing log file");
std::string logfilename=cmdline.next();
/*----------------------------------------------------------------------*/
// open files
std::ifstream infs(infilename.c_str());
datread::ianystream ins(infs, datread::anyID(opt.inputformat));
std::ifstream tabfs(tabfilename.c_str());
std::ofstream resfs(resfilename.c_str());
sff::SFFostream<Tseries> ress(resfs);
std::ofstream logfs(logfilename.c_str());
/*----------------------------------------------------------------------*/
// read the definition table
/*----------------------------------------------------------------------*/
// cycle through all traces
while (ins.good()) {
// create a double precision series container
Tseries series;
// read the series
ins >> series;
ress << series;
sff::WID2 wid2;
ins >> wid2;
ress << wid2;
if (opt.verbose)
{
cout << "read time series:" << endl;
cout << " " << wid2.station << " " << wid2.channel << " "
<< wid2.auxid << endl;
}
} // end of cycling through all traces
}
/* ----- END OF dccal.cc ----- */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment