# Application of Dynamic Time Warping to Determine the Shear Wave Velocity from the Down-Hole Test
## 3 Data Preparation  
The shear wave arrives first at the upper geophone and later at the lower geophone (\(\Delta\)t). Due to depth deference, the amplitudes are different, and both measurements are often noisy or contain irregularities from various origins. To utilize the DTW method for comparing the waves recorded using two geophones, it is imperative to effectively eliminate any irregularities and phenomena that may cause inaccurate matching. It is necessary to avoid cases where the algorithm will try to find a relationship between incorrect values in the signals, including noise. The most informative fragment (the shadowed part in Figure 2) to be compared in order to find the arrival time difference is the moment of the appearance of the greatest amplitude to the vanishing of the signal. The remaining fragments mainly contain noise, which is not relevant for analysis. The same wave recorded using upper and lower geophones may have a different noise appearance; it has been observed that more in-depth measurements have more noticeable noise. Furthermore, it has been observed that the noise present in the signal prior to the arrival of the wave may exhibit a different character than it does at the time of the wave's appearance. Consequently, the signal decomposition method was deemed unsuitable, and simple smoothing techniques were employed to mitigate the noise. Another anomaly detected in the signals is the occurrence of a trend or the signal shift by a constant value. The wave should ideally oscillate around zero, and any trend or shift is considered abnormal and may result in measurement errors. To address this, a linear trend was fitted to the signal in each case and removed. Another phenomenon that can impact signal comparison is varying amplitude values. While they are not data errors, comparing two signals with differing amplitudes can lead to inaccurate outcomes. Thus, the decision was made to normalize the compared wave values with respect to their amplitudes. Additionally, extracting the most informative segment  
Figure 1: Closed Gilów TSF from a bird’s-eye view and approximate location (red point). Figure 2: An example of a signal measured using one geophone. The shadowed part is the most informative part. from the signal is a crucial step toward improving the quality of the results. Geophone signal registration occurs over a fixed duration, including the period before wave arrival, the moment of peak amplitude, and the damped wave signal. Taking into account all the above factors, the following methods of preparing shear wave data are proposed. 1. The smoothing of the s signal value in order to minimize the noise was performed using a simple moving average in a window of 10 samples (2 ms); \[\mathrm{SMA(i)}=0.1\cdot[\mathrm{s(i-10)+s(i-9)+\ldots+s(i)}].\] (2)
2. The removal of the linear trend selected using the least squares method; \[\hat{y}(i)=\mathrm{as(i)+b}.\] (3)
3. The normalization of signals recorded using both geophones \(\mathrm{s_{1}}\) and \(\mathrm{s_{2}}\) in terms of amplitude; \[\mathrm{s_{1\;norm}}=\frac{\mathrm{s_{1}}}{\mathrm{d}},\] (4) \[\mathrm{s_{2\;norm}}=\frac{\mathrm{s_{2}}}{\mathrm{d}},\] (5) where \(\mathrm{d}=\mathrm{max}(\mathrm{max}(|\mathrm{s_{1}}|),\mathrm{max}(| \mathrm{s_{2}}|))\). 4. The isolation of the information part of the signal s. 1. The determination of the signal envelope relative to the quantiles counted in the window of 100 samples: \(\mathrm{q_{0.05}}\) is the lower envelope, and \(\mathrm{q_{0.95}}\) is the upper envelope. 2. The determination of moving average values in a window of 100 samples for positive signal values \(\mathrm{\overline{s}_{+}}\) and negative signal values \(\mathrm{\overline{s}_{-}}\). 3.