97 {
98 int k;
99 double rampslope;
100 if (head) {
102 stringstream ss;
103 ss << "LinearTaper::apply: inconsistent head taper parameters" << endl
104 <<
"Data endtime=" << d.
endtime()
105 << " which is earlier than start of head taper=" << t0head << endl
106 << "Data vector was not altered" << endl;
107 d.elog.
log_error(
"LinearTaper", ss.str(), ErrorSeverity::Complaint);
108 return -1;
109 }
110 int is;
111 double t, wt;
112 for (t = d.
t0(); t < t0head; t += d.
dt()) {
114 if (is >= 0 && is < d.
npts()) {
115 for (k = 0; k < 3; ++k)
117 }
118 }
119 rampslope = 1.0 / (t1head - t0head);
120 for (t = t0head; t < t1head; t += d.
dt()) {
122 if (is >= 0) {
123 wt = rampslope * (t - t0head);
124 for (k = 0; k < 3; ++k)
126 }
127 }
128 }
129 if (tail) {
130 if (d.
t0() > t0tail) {
131 stringstream ss;
132 ss << "LinearTaper::apply: inconsistent tail taper parameters" << endl
133 <<
"Data start time=" << d.
t0()
134 << " is after the end of the tail taper = " << t0tail << endl
135 << "Data vector was not altered" << endl;
136 MsPASSError merr(ss.str(), ErrorSeverity::Complaint);
137 d.elog.
log_error(
"LinearTaper", ss.str(), ErrorSeverity::Complaint);
138 return -1;
139 }
140 int is;
141 double t, wt;
142 for (t = d.
endtime(); t >= t0tail; t -= d.
dt()) {
144 if (is >= 0 && is < d.
npts()) {
145 for (k = 0; k < 3; ++k)
147 }
148 }
149 rampslope = 1.0 / (t0tail - t1tail);
150 for (t = t0tail; t >= t1tail; t -= d.
dt()) {
152 if (is >= 0) {
153 wt = rampslope * (t - t1tail);
154 for (k = 0; k < 3; ++k)
156 }
157 }
158 }
159 return 0;
160}
size_t npts() const
Definition BasicTimeSeries.h:171
double t0() const
Definition BasicTimeSeries.h:174
int sample_number(double t) const
Definition BasicTimeSeries.h:72
double dt() const
Definition BasicTimeSeries.h:153
mspass::utility::dmatrix u
Definition CoreSeismogram.h:52
double endtime() const noexcept
Definition CoreSeismogram.h:497
int log_error(const mspass::utility::MsPASSError &merr)
Definition ErrorLogger.cc:72