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

prepared framework for offset dependent filters

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: 4482
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 7b355793
......@@ -33,7 +33,11 @@
* - 21.12.2010 V1.2 implement output file type option
* - 27.07.2011 V1.3 implement apply trace modifier
* - 08.09.2011 V1.4 support format modifiers
* - 26.01.2012 V1.5 write header data only if supported by output format
* - 26.01.2012 V1.5
* - write header data only if supported by output
* format
* - prepared framework to apply offset dependent
* tapers
*
* ============================================================================
*/
......@@ -107,8 +111,17 @@ int main(int iargc, char* argv[])
" a:T apply filter to traces T, where T may be any range" "\n"
" specification like \'3-4\' or \'5,6,7-12,20\'" "\n"
" all other traces are passed to the output unchanged\n"
" prft:file\n"
" pre-filter taper from file to be applied before\n"
" filtering traces\n"
" poft:file\n"
" post-filter taper from file to be applied before\n"
" filtering traces\n"
" file mofifiers t and a are mutually exclusive, where a\n"
" has higher precendence\n"
" prft and poft taper parameters are read from \"file\"\n"
" taper parameter file is expected in format produced\n"
" by refract\n"
"\n"
"-xhelp print detailed information regarding file formats" "\n"
"-v be verbose" "\n"
......@@ -155,9 +168,12 @@ int main(int iargc, char* argv[])
static const char tracekey[]="t";
static const char applykey[]="a";
static const char formatkey[]="f";
static const char prefiltertaperkey[]="prft";
static const char postfiltertaperkey[]="poft";
// define commandline argument modifier keys
static const char* cmdlinekeys[]={tracekey, formatkey, applykey, 0};
static const char* cmdlinekeys[]
={tracekey, formatkey, applykey, prefiltertaperkey, postfiltertaperkey, 0};
// no arguments? print usage...
if (iargc<2)
......@@ -404,7 +420,28 @@ int main(int iargc, char* argv[])
=datrw::ianystream::openmode(inputformat);
std::ifstream ifs(infile->name.c_str(), iopenmode);
datrw::ianystream is(ifs, inputformat);
// read tapers
// -----------
bool applyprefiltertaper=infile->haskey(prefiltertaperkey);
bool applypostfiltertaper=infile->haskey(postfiltertaperkey);
// create taper objects here
// read taper parameters here
if (applyprefiltertaper)
{
std::string taperfilename
=infile->value(prefiltertaperkey);
}
if (applypostfiltertaper)
{
std::string taperfilename
=infile->value(postfiltertaperkey);
}
// handle file header
// ------------------
sff::SRCE insrceline;
if (firstfile)
{
if (is.hasfree())
......@@ -417,7 +454,6 @@ int main(int iargc, char* argv[])
if (os.handlesfilefree()) { os << filefree; }
if (is.hassrce())
{
sff::SRCE insrceline;
is >> insrceline;
if (os.handlessrce()) { os << insrceline; }
}
......@@ -465,10 +501,24 @@ int main(int iargc, char* argv[])
is >> wid2;
TFXX_debug(opt.debug, "main",
" series and WID2 are read");
sff::INFO info;
if (is.hasinfo())
{
is >> info;
}
// apply filter only if requested
// ------------------------------
if ((!doapply) || traceranges.contains(itrace))
{
if (applyprefiltertaper)
{
// apply pre-filter taper
}
filter(Ttimeseries(series, wid2.dt), opt.debug);
if (applypostfiltertaper)
{
// apply post-filter taper
}
TFXX_debug(opt.debug, "main",
" series is filtered");
if (opt.debugdump)
......@@ -478,6 +528,7 @@ int main(int iargc, char* argv[])
DUMP(series);
}
if (opt.verbose) { std::cout << " filtered" << std::endl; }
// ------------------------------
}
else
{
......@@ -488,8 +539,6 @@ int main(int iargc, char* argv[])
" series and WID are written");
if (is.hasinfo())
{
sff::INFO info;
is >> info;
if (os.handlesinfo()) { os << info; }
}
if (is.hasfree() || true)
......
Markdown is supported
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