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

offset variable taper is implemented and tested

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: 4491
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent d1429509
......@@ -36,8 +36,7 @@
* - 26.01.2012 V1.5
* - write header data only if supported by output
* format
* - prepared framework to apply offset dependent
* tapers
* - implemented offset variable tapers
*
* ============================================================================
*/
......@@ -62,6 +61,7 @@
#include <sffxx.h>
#include <sffostream.h>
#include <aff/dump.h>
#include <tsxx/ovtaper.h>
using std::cout;
using std::cerr;
......@@ -91,8 +91,8 @@ int main(int iargc, char* argv[])
{
TIDOFI_VERSION "\n"
"usage: tidofi [-v] [-o] [-cf file] [-cs] [-type type] [-Type type]" "\n"
" outfile infile [t:T|a:T] [f:F]\n"
" [infile [t:T|a:T] [f:F] ... ]" "\n"
" outfile infile [t:T|a:T] [f:F] [prft:file] [poft:file]\n"
" [infile [t:T|a:T] [f:F] [prft:file] [poft:file] ... ]" "\n"
" or: tidofi --help|-h" "\n"
" or: tidofi --xhelp" "\n"
};
......@@ -427,21 +427,27 @@ int main(int iargc, char* argv[])
bool applypostfiltertaper=infile->haskey(postfiltertaperkey);
// create taper objects here
ts::tapers::OffsetVariableTaper prefiltertaper;
ts::tapers::OffsetVariableTaper postfiltertaper;
// read taper parameters here
if (applyprefiltertaper)
{
std::string taperfilename
=infile->value(prefiltertaperkey);
prefiltertaper.read(taperfilename);
}
if (applypostfiltertaper)
{
std::string taperfilename
=infile->value(postfiltertaperkey);
postfiltertaper.read(taperfilename);
}
// handle file header
// ------------------
sff::SRCE insrceline;
bool srceavailable=false;
if (firstfile)
{
if (is.hasfree())
......@@ -455,6 +461,7 @@ int main(int iargc, char* argv[])
if (is.hassrce())
{
is >> insrceline;
srceavailable=true;
if (os.handlessrce()) { os << insrceline; }
}
}
......@@ -510,14 +517,30 @@ int main(int iargc, char* argv[])
// ------------------------------
if ((!doapply) || traceranges.contains(itrace))
{
double offset, t0, T;
if (applyprefiltertaper || applypostfiltertaper)
{
TFXX_assert(is.hasinfo() && srceavailable,
"Offset variable taper requires source and receiver "
"coordinates");
offset=::sff::offset(insrceline, info);
t0=libtime::time2double(insrceline.date-wid2.date);
T=wid2.dt*wid2.nsamples;
}
if (applyprefiltertaper)
{
// apply pre-filter taper
ts::tapers::FourPoint taper
=prefiltertaper.taper(offset, t0, T);
taper.apply(series);
}
filter(Ttimeseries(series, wid2.dt), opt.debug);
if (applypostfiltertaper)
{
// apply post-filter taper
ts::tapers::FourPoint taper
=postfiltertaper.taper(offset, t0, T);
taper.apply(series);
}
TFXX_debug(opt.debug, "main",
" series is filtered");
......
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