## 5 Robustness of P-Wave First-Motion Polarity  
In Ref. [15], the authors calibrated the polarity error rate for the handmade first-motion polarities with similar events and found that \(\sim\)10% of the impulsive polarities and \(\sim\)20% of the emergent polarities were wrong. In order to test the robustness of the DiTingMotion, we flipped the amplitudes of 2389 waveforms and detected their polarities with DiTingMotion again. The test showed that for 2389 reversed waveforms, 56 polarities were misidentified. The detection accuracy was 97.66%, which was similar to that before the waveform flip. This test indicated that DiTingMotion has good robustness in determining the first-motion polarity.  
The precision of the P-wave arrival time will affect the discrimination of first-motion polarity, especially when there is strong noise before the P-wave, which may cause the opposite sign of the first motion. To investigate whether the detection results were affected by the P-wave arrival time, we added a random shift to the P-wave arrival times of 2389 waveforms to simulate the picking error. The predominant P-wave period of the local earthquakes recorded by the regional network was generally 0.1-0.2 s. We applied a random error within \(\pm\)0.1 s to the arrival time of the P-wave, and cut the waveforms with the shifted arrival times. Then, we detected the polarities with DiTingMotion again. Tests showed that when the arrival time of the P-wave was incorrectly marked, the detection accuracy of P-wave first-motion polarities decreased by 5.61-22.1% (Table 2).  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Method** & **Up** & **Down** & **Uncertain** & **TP** & **FP** & **TP/ALL** \\ \hline DiTingMotion & & & & & & \\ (This Study) & 1376 & 1013 & 0 & 2353 & 36 & 98.49\% \\ PhasePApy [23] & 768 & 509 & 1112 & 1275 & 2 & 53.37\% \\ NPC [59] & 1366 & 1023 & 0 & 2261 & 128 & 94.64\% \\ \hline \hline \end{tabular} Note: Uncertain indicates the number of polarities that cannot be determined; TP and FP represent the numbers of consistent and inconsistent polarities between automatic methods and manual discrimination; ALL represents 2389 P-wave first-motion polarities used for test; TP/ALL represents the accuracy.  
\end{table}
Table 1: Comparison of polarity classification results obtained with different methods.  
To further analyze the reason for the drop in accuracy, we calculated the signal-to-noise ratio (SNR) of the waveform. The formula for calculating SNR is as follows:  
\[\text{SNR}=10\times\log_{10}\biggl{(}\frac{\text{signal}}{\text{noise}}\biggr{)} ^{2} \tag{1}\]  
where signal is the maximum absolute value of the amplitude in the signal window, noise is the root mean square of the waveform amplitude in the noise window, and the unit of SNR is dB. The signal window is taken as 0.5 s after the arrival time of the P-wave, and the noise window is taken as 0.5-1.5 s before the arrival time of the P-wave.  
We take the SNR of 30 dB as the boundary, divide the data into two categories--high SNR and low SNR--and calculate the detection accuracy at different SNRs (Table 2). When the SNR is high, the arrival deviation has less influence on the accuracy of polarity detection; however, when the picked arrival time is earlier, the false detection rate is higher. It can be seen that when using DiTingMotion to detect the P-wave first-motion polarities, the picking accuracy of the P-wave arrival time should be as accurate as possible. For the manually picked arrival times, one can use deep learning-based methods, such as Refs. [32,34], etc., to detect the event waveform again, and select the waveform that is manually and automatically marked at the same time (the residual less than 0.1 s) to detect its first-motion polarities. On the one hand, this can ensure the reliability of the first-motion polarities. On the other hand, it can also improve the waveform utilization. In some cases, only the arrival time is picked manually, but the initial movement symbol is not given.