Commit ce60ea64 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[FIX] (libtsxx): make offset variable taper robust

Offset variable tapers are defined be picking times and offsets in a
seismogram display. It is quite likely that some of these picks, in particular
for near-source traces, are not within the time window of seismic sample data.
In such cases the four-point taper complaines and aborts. The offset variable
taper now ensures reasonable values to be passed to the four-point taper in
any case, by applying lower and upper bounds to the time values.
parent 4d6484fb
......@@ -28,12 +28,14 @@
*
*
* REVISIONS and CHANGES
* - 26/01/2012 V1.0 Thomas Forbriger
* - 26/01/2012 V1.1 Thomas Forbriger
* - 19/06/2016 V1.2 make offset variable taper robust in case of picks
* outside seismogram range
*
* ============================================================================
*/
#define TSXX_OVTAPER_CC_VERSION \
"TSXX_OVTAPER_CC V1.0 "
"TSXX_OVTAPER_CC V1.2"
#include <fstream>
#include <sstream>
......@@ -134,10 +136,17 @@ namespace ts {
TSXX_assert(Mvalid,
"OffsetVariableTaper::taper: "
"taper is undefined");
// calculate times in units of the duration of the time series
double t1=(Mt1.time(offset)-T0)/T;
double t2=(Mt2.time(offset)-T0)/T;
double t3=(Mt3.time(offset)-T0)/T;
double t4=(Mt4.time(offset)-T0)/T;
// keep values in bounds of time series
t1 = t1 >= 0. ? t1 : 0.;
t2 = t2 >= 1.e-6 ? t2 : 1.e-6;
t3 = t3 <= .99999 ? t3 : .99999;
t4 = t4 <= 1. ? t4 : 1.;
// initialize taper
ts::tapers::FourPoint fpt(t1, t2, t3, t4);
return(fpt);
} // ts::tapers::FourPoint OffsetVariableTaper::taper(...)
......
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