A Synchronous Magnitude Estimation with P-Wave Phases’ Detection Used in Earthquake Early Warning System

How to estimate an earthquake’s magnitude rapidly and accurately is a challenge for any earthquake early warning system. In order to reach a balance between accuracy and timeliness, a synchronous magnitude estimation method with P-wave phases’ detection is proposed. In this method, the P-wave phases are detected by the changes of the signal-to-noise ratio (SNR) of the seismic records, where the SNRs are calculated by the short-term power and long-term power ratio (STP/LTP). Meanwhile, the variations of the SNR are applied to estimate the magnitude of the earthquake. By the statistics of some earthquake cases, a synchronous magnitude estimation model of the variation of the P-wave phases’ SNR, the earthquake magnitude, and the hypocentral distance was built. Compared with some other magnitude estimation methods, the suggested method inherits the robustness of the STP/LTP method and is more accurate and rapid than the peak displacement (Pd) method.


Introduction
A rapid and accurate earthquake warning system (EEW) can effectively reduce casualties and economic losses caused by earthquakes. The concept of an earthquake early warning system was first proposed by Dr. Cooper of the United States in 1868 [1] and has been built in many areas and achieved good results in earthquake prevention and mitigation [2][3][4][5][6]. Where magnitude estimation plays a key role in earthquake early warning system, the data used to estimate the magnitude are obtained by seismic sensors. The MEMS accelerometer in the seismic sensor monitors the ground motion data in real time, then calculates the parameters required for magnitude estimation through the corresponding algorithm. On the premise of stable performance of the seismic sensors [7], it is a challenge to improve the timeliness and accuracy of the magnitude estimation algorithm. As two important parameters for estimating the magnitude of an earthquake, timeliness and accuracy are always a pair of contradictions. A large number of research efforts have been made to keep the balance between accuracy and timeliness. At present, there are many methods for real-time magnitude estimation, mainly including periodic methods, displacement amplitude methods, energy methods, and machine learning methods.
The τ max p method, as one of periodic methods, was first proposed by Nakamura, which calculates the predominant period of ground motion according to real-time seismic velocity records [1]. This method has certain limitations, and its accuracy and stability are easily affected by sampling rate and data preprocessing. Selecting different filters or filtering time windows will have a great impact on the calculation results of the characteristic period. Allen and Kanamori improved the τ p algorithm, and it was regarded that the maximum value of the dominant period within a few seconds of the P waves phases' waves and S waves produced by the earthquake carry a lot of seismic information, P waves carry the information of fault sliding, and S waves carry the main energy information of the earthquake. In this paper, it is assumed that there is a certain weak seismic energy in P waves, and there is a certain attenuation relationship between the energy and hypocentral, and the magnitude is estimated by using this initial energy information and hypocentral.
The relationship between the magnitude M, maximum displacement peak P d , and hypocentral distance R proposed by Wu et al., is shown in Equation (1).
where M is the surface wave magnitude, A, B, and C are the fitting coefficients, P d is the peak amplitude of displacement in the first three seconds after the arrival of the P waves, and R is the hypocentral distance. The STP/LTP method provides a new method for P waves' arrival extraction and rapid calculation of instantaneous SNR [21]. Here, it can be considered to use the maximum ratio P SNR of effective energy of instantaneous SNR to background noise as a new measure to replace the P d parameter to reconstruct this relationship model so as to realize the synchronous estimation of earthquake magnitude. According to the literature and observation records, the regression relationship among magnitude M, P SNR , and hypocentral distance R is put forward, namely where M is the surface wave magnitude, A, B, and C are the fitting coefficients, P SNR is the instantaneous maximum value of STP/LTP corresponding to the arrival of P waves, and R is the hypocentral distance. The STA/LTA method is often used as the criterion for P waves' arrival. The long-time window represents the energy of background noise and the short-time window represents the energy of P waves' effective signal. When the background noise is stable, namely when the background noise conforms to the state of stationary random process, the effective signal energy of P waves can be used as the representative of seismic energy. The Equation (3) is the calculation equation of STA/LTA.
where STA i and LTA i are the mean value of characteristic function of short window and long window respectively, CF is the characteristic function, and S is the length of the short window and L is the length of the long window. According to the internal relationship between signal-to-noise ratio (SNR) and STA/LTA, Fu et al., proposed the automatic extraction method (STP/LTP) of seismic P waves' arrival time based on SNR. SNR is often used to represent the relative strength of effective signal and background noise. The SNR calculation equation is shown in Equations (4) and (5).
where SNR is signal-to-noise ratio, P e is the effective signal power, P n is the background noise power, and dSNR is the signal-to-noise ratio expressed linearly. Where P e and P n are usually described by relative power, the calculation method is Equation (6): where x i (i = 1, 2, . . . , N) is the value of the observed signal and x is the mean value of the observed signal.
In the STP/LTP method, in order to represent the energy of the ground vibration signal effectively, the characteristic function is constructed from the perspective of relative power, as shown in Equation (7).
The STP/LTP equation is When the STP/LTP value exceeds a certain threshold, the arrival of P waves can be determined. At this time, the peak value of STP/LTP in P waves is P SNR , as shown in Equation (9). Figure 1 shows the application flowchart of the new method. In the practical application scenario, the sensor performs real-time monitoring, and the data is transmitted to the computer in real time to calculate the STP/LTP at each time in the observation signal. When the STP/LTP exceeds the preset trigger threshold at a certain time, that means that the arrival of P waves is determined, which is recorded as the arrival time of P waves, and then the P SNR of P waves is determined. Finally, the P SNR and the hypocentral distance obtained are substituted into the relationship model for magnitude estimation. where ( = 1,2, … , ) is the value of the observed signal and ̅ is the mean value of th observed signal. In the STP/LTP method, in order to represent the energy of the ground vibration sig nal effectively, the characteristic function is constructed from the perspective of relativ power, as shown in Equation (7).
When the STP/LTP value exceeds a certain threshold, the arrival of P waves can b determined. At this time, the peak value of STP/LTP in P waves is , as shown in Equa tion (9). = max ( ) (9 Figure 1 shows the application flowchart of the new method. In the practical appl cation scenario, the sensor performs real-time monitoring, and the data is transmitted t the computer in real time to calculate the STP/LTP at each time in the observation signa When the STP/LTP exceeds the preset trigger threshold at a certain time, that means tha the arrival of P waves is determined, which is recorded as the arrival time of P waves, an then the ofsensors-1730527-R2 P waves is determined. Finally, the and the hy pocentral distance obtained are substituted into the relationship model for magnitude es timation.

Performance Analysis and Results
Sichuan Province of China is located between the Indian Ocean Plate and the Eurasian Plate, where crustal movement is very frequent. There are many seismic belts in Sichuan Province. Under the action of multiple seismic belts, the underground rock strata are fractured and misplaced, resulting in the occurrence of large and small earthquakes in the region. Wenchuan M8.0 earthquake on 12 May 2008 caused a large number of casualties and economic losses.
Data for this study were provided by the National Key Research and Development Program of China (No. 2019YFC1509205), Institute of Engineering Mechanics, China Earthquake Administration and China Earthquake Networks Center, National Earthquake Data Center (http://data.earthquake.cn, accessed on 31 October 2021). In these records, the verticle (U−D) direction ground motion data has the stable background noise, which is convenient for seismic phase identification. In the process of selecting ground motion data, the principle of station data selection is as follows: for the M ≤ 5.0 earthquakes, the station data with hypocentral distance less than 50 km are selected; for the M > 5.0 earthquakes, station data with hypocentral distance less than 100 km are selected.

Performance Analysis and Results
Sichuan Province of China is located between the Indian Ocean Plate and the Eurasian Plate, where crustal movement is very frequent. There are many seismic belts in Sichuan Province. Under the action of multiple seismic belts, the underground rock strata are fractured and misplaced, resulting in the occurrence of large and small earthquakes in the region. Wenchuan M8.0 earthquake on 12 May 2008 caused a large number of casualties and economic losses.
Data for this study were provided by the National Key Research and Development Program of China (No. 2019YFC1509205), Institute of Engineering Mechanics, China Earthquake Administration and China Earthquake Networks Center, National Earthquake Data Center (http://data.earthquake.cn, accessed on 31 October 2021). In these records, the verticle (U−D) direction ground motion data has the stable background noise, which is convenient for seismic phase identification. In the process of selecting ground motion data, the principle of station data selection is as follows: for the M ≤ 5.0 earthquakes, the station data with hypocentral distance less than 50 km are selected; for the M > 5.0 earthquakes, station data with hypocentral distance less than 100 km are selected.

Small Earthquake Data Analysis
In the sample data, the data of 3.0 ≤ M ≤ 4.7 small earthquakes were provided by the National Key Research and Development Program of China (No. 2019YFC1509205). The data is monitored by low-cost MEMS seismic sensors named MEMS Network Strong Motion Seismograph (MNSMS), which is equipped with a high-performance three-axis linear Class C MEMS accelerometer, and the photograph of the MNSMS is shown in Figure 3. The MNSMS is mainly composed of some hardware modules: the MEMS accelerometer module, TCP/IP module, Power over Ethernet (PoE) module, and local storage module (optional). The MNSMS can meet the needs of dense EEW in terms of noise, dynamic range, useful resolution, reliability, and detecting capabilities with its high-performance [7]. The sampling rate of the MNSMS is 50 Hz.

Small Earthquake Data Analysis
In the sample data, the data of 3.0 ≤ ≤ 4.7 small earthquakes were provided by the National Key Research and Development Program of China (No. 2019YFC1509205). The data is monitored by low-cost MEMS seismic sensors named MEMS Network Strong Motion Seismograph (MNSMS), which is equipped with a high-performance three-axis linear Class C MEMS accelerometer, and the photograph of the MNSMS is shown in Figure 3. The MNSMS is mainly composed of some hardware modules: the MEMS accelerometer module, TCP/IP module, Power over Ethernet (PoE) module, and local storage module (optional). The MNSMS can meet the needs of dense EEW in terms of noise, dynamic range, useful resolution, reliability, and detecting capabilities with its high-performance [7]. The sampling rate of the MNSMS is 50 Hz.   Figure 4c, it can be clearly seen that when the P wave arrives, the STP/LTP value increases significantly. Soon, the value appears, which indicates that the ground motion information contains some energy at the initial stage of the P waves, and the energy is significantly more than the energy of the background noise. It can be found that the value corresponding to the S wave is smaller than the P wave's, which is not that the energy of S waves is small, but the observation signal in the long-time window is mostly the energy of seismic waves. In Figure 4e,f, when the seismic signal does not arrive, the relative power in the short-time window is the relative power of the background noise, which is close to 0, and the state is very stable. When the seismic waves arrive, the relative power in the short-time window is the sum of the relative power of the seismic signal and the relative power of the background noise in the short-time window, but the relative power of the background noise in the short-time window is much smaller compared with the relative power of the seismic signal. Therefore, in the process of an earthquake, the relative power of the short-time window can represent the energy of the ground motion signal. Finally, when the seismic waves are over, only background noise is left in the short-time window, and the relative power is back to about 0. In Figure 4g,h, when the seismic signal does not arrive, the relative power of the long-time window is the relative power of the background noise, the value is close to 0, and the state is also very stable. When the seismic waves arrive, the relative power of the long-time window is the sum of the relative power of the seismic signal in the long-time window and the relative power of the background noise. In the process of an earthquake, the relative power of the long window can also represent the energy of the ground motion signal. However, unlike the short-time window, the length of the long window is very long. After averaging, the relative power of the seismic signal   Figure 4c, it can be clearly seen that when the P wave arrives, the STP/LTP value increases significantly. Soon, the P SNR value appears, which indicates that the ground motion information contains some energy at the initial stage of the P waves, and the energy is significantly more than the energy of the background noise. It can be found that the P SNR value corresponding to the S wave is smaller than the P wave's, which is not that the energy of S waves is small, but the observation signal in the long-time window is mostly the energy of seismic waves. In Figure 4e,f, when the seismic signal does not arrive, the relative power in the short-time window is the relative power of the background noise, which is close to 0, and the state is very stable. When the seismic waves arrive, the relative power in the short-time window is the sum of the relative power of the seismic signal and the relative power of the background noise in the short-time window, but the relative power of the background noise in the short-time window is much smaller compared with the relative power of the seismic signal. Therefore, in the process of an earthquake, the relative power of the short-time window can represent the energy of the ground motion signal. Finally, when the seismic waves are over, only background noise is left in the short-time window, and the relative power is back to about 0. In Figure 4g,h, when the seismic signal does not arrive, the relative power of the long-time window is the relative power of the background noise, the value is close to 0, and the state is also very stable. When the seismic waves arrive, the relative power of the long-time window is the sum of the relative power of the seismic signal in the long-time window and the relative power of the background noise. In the process of an earthquake, the relative power of the long window can also represent the energy of the ground motion signal. However, unlike the short-time window, the length of the long window is very long. After averaging, the relative power of the seismic signal increases and decreases slowly. Finally, when the seismic waves are over, only background noise is left in the long-time window, and the relative power is back to about 0. increases and decreases slowly. Finally, when the seismic waves are over, only background noise is left in the long-time window, and the relative power is back to about 0. It is worth noting that when the noise is weak and stable, to a certain extent, although long-time and short-time windows can represent the energy of seismic waves, our purpose is to estimate the magnitude through the initial information of P waves. If the short-time window is just at the arrival time of P waves, then the short-time window represents the relative power of P waves, while the relative power of P waves in the long-time window is only S/L after averaging. Since S is much less than L, the relative power of the long-time window is still considered as the power of background noise at the arrival time of P waves. In this way, when the P waves arrive, it can not only effectively detect the P waves, but also obtain the relative energy proportion at the initial time of the P waves, and the P SNR value appears soon after the arrival of the P waves, which is the significance of this method. Multiple experimental results show that the time of the P SNR value is very close to the time of the P waves' arrival, which usually occurs within 2 s after the arrival of the P waves, and sometimes even occurs simultaneously with the time of the P waves' arrival.
Small earthquakes occur frequently in earthquake events. The signal's energy of small earthquakes is weak and the SNR is low, so the detection of P waves' arrival time faces many difficulties. The STP/LTP method has strong robustness, can adapt to weak noise, general noise, and strong noise; its misjudgment rate and missing rate are low. The P SNR method follows the advantages of STP/LTP method and can accurately obtain the P SNR value in strong noise environment.
For the M < 5.0 small earthquakes, the energy information carried by the P waves is not very strong, and the information cannot be monitored by the stations far away. Figure 5 shows the relationship between the P SNR value and the hypocentral distance in a M4.0 earthquake. It can be seen that when the hypocentral distance reaches 50 km, the P SNR value has dropped to below 4, which makes it vulnerable to background noise. In addition, Figure 5 also reflects the attenuation relationship between P SNR value and hypocentral distance. With the increase in hypocentral distance, the energy of seismic waves decreases gradually, so the P SNR value will also decrease. It is worth noting that when the noise is weak and stable, to a certain extent, although long-time and short-time windows can represent the energy of seismic waves, our purpose is to estimate the magnitude through the initial information of P waves. If the shorttime window is just at the arrival time of P waves, then the short-time window represents the relative power of P waves, while the relative power of P waves in the long-time window is only S/L after averaging. Since S is much less than L, the relative power of the longtime window is still considered as the power of background noise at the arrival time of P waves. In this way, when the P waves arrive, it can not only effectively detect the P waves, but also obtain the relative energy proportion at the initial time of the P waves, and the value appears soon after the arrival of the P waves, which is the significance of this method. Multiple experimental results show that the time of the value is very close to the time of the P waves' arrival, which usually occurs within 2 s after the arrival of the P waves, and sometimes even occurs simultaneously with the time of the P waves' arrival.
Small earthquakes occur frequently in earthquake events. The signal's energy of small earthquakes is weak and the SNR is low, so the detection of P waves' arrival time faces many difficulties. The STP/LTP method has strong robustness, can adapt to weak noise, general noise, and strong noise; its misjudgment rate and missing rate are low. The method follows the advantages of STP/LTP method and can accurately obtain the value in strong noise environment. For the M < 5.0 small earthquakes, the energy information carried by the P waves is not very strong, and the information cannot be monitored by the stations far away. Figure  5 shows the relationship between the value and the hypocentral distance in a M4.0 earthquake. It can be seen that when the hypocentral distance reaches 50 km, the value has dropped to below 4, which makes it vulnerable to background noise. In addition, Figure 5 also reflects the attenuation relationship between value and hypocentral distance. With the increase in hypocentral distance, the energy of seismic waves decreases gradually, so the value will also decrease.

Large Earthquake Data Analysis
The large earthquake data (M = 6, 7, 8) were provided by the Institute of Engineering Mechanics, China Earthquake Administration and China Earthquake Networks Center, National Earthquake Data Center (http://data.earthquake.cn, accessed on 31 October 2021). The sampling rate is 200 Hz. The rupture duration of small earthquakes is short, and P waves and S waves are usually separated in time. Large earthquakes rupture for a long time and P waves are continuously emitted during the rupture, which results in P waves and S waves sometimes partly overlapping. It means that it is difficult to detect P waves. However, the large earthquake rupture growth is large enough, although the initial S waves make some interference, and P waves can still be clearly detected [23]. Figure 6 shows the records of U−D direction of the M7.0 earthquake and the corresponding results of STP/LTP, STP, LTP calculation. It can be seen that the waveform of the large earthquake lasts for a long time. In Figure 6c,d, STP/LTP value will be at a high level within a period of time after the arrival of the P waves; P SNR value is also determined in a very short time. In Figure 6e, the relative power variation in short-time window and long-time window of large earthquake is the same as that of small earthquake. Different from small earthquakes, the relative power value of the seismic signal in short-time window and long-time window of large earthquakes is higher than that of small earthquakes, and the duration is longer than that of small earthquakes, which also reflects the characteristics of large earthquakes. Compared with small earthquakes, the energy of large earthquakes is very strong, and the duration of earthquakes is longer. According to the rule of small earthquakes, the large earthquake response also conforms to the relationship of energy attenuation with hypocentral distance. Figure 7 shows the relationship between the energy of the earth- Compared with small earthquakes, the energy of large earthquakes is very strong, and the duration of earthquakes is longer. According to the rule of small earthquakes, the large earthquake response also conforms to the relationship of energy attenuation with hypocentral distance. Figure 7 shows the relationship between the energy of the earthquake and the hypocentral distance in the M7.0 earthquake. It can be seen that when the hypocentral distance reaches 100 km, the P SNR value also drops to about 6, and when the distance is larger, the P SNR value will also be submerged by noise. Different from small earthquakes, for the same hypocentral distance, the P SNR of large earthquakes is significantly higher than that of small earthquakes, and the attenuation of the P SNR in the large earthquakes is slower, which indicates the characteristics of the large earthquake energy. In addition, it should be noted that for the large earthquakes, the hypocentral distance of the stations should not be too small. When the station is close to the seismic center, on the one hand, it is difficult to distinguish between P waves and S waves, which affects the detection of P waves. On the other hand, due to the overlap of P waves and S waves, the P SNR value is too large, which is not within the range of P SNR attenuation relationship.
Sensors 2022, 22, x FOR PEER REVIEW one hand, it is difficult to distinguish between P waves and S waves, which affe detection of P waves. On the other hand, due to the overlap of P waves and S wav value is too large, which is not within the range of attenuation relation

Comprehensive Analysis
For the earthquakes with different magnitude ranges, Figure 8 shows the distribution of P SNR value on hypocentral distance R. The earthquakes ranging from M3.0 to M4.0, M4.5 to M6.0, and large earthquakes ranging from M7.0 to M8.0, are selected for comparative analysis. It can be seen that for the same hypocentral distance, the P SNR value of large earthquakes is significantly higher than that of small earthquakes. With the increase in the magnitude, the energy increases, and the P SNR value will also increase. In the same magnitude range, the P SNR value has also a certain attenuation trend with the hypocentral distance. In each magnitude range, the P SNR values are distributed according to a certain linear relationship. There are also some discrete points in the diagram, and even some discrete points are located in other magnitude ranges, which is realistic and indicates the complexity of the process of the seismic energy release.
in the magnitude, the energy increases, and the value will also increase. In the same magnitude range, the value has also a certain attenuation trend with the hypocentral distance. In each magnitude range, the values are distributed according to a certain linear relationship. There are also some discrete points in the diagram, and even some discrete points are located in other magnitude ranges, which is realistic and indicates the complexity of the process of the seismic energy release. A large number of studies have shown that when the earthquake energy reaches a certain degree, the magnitude saturation phenomenon will occur. By comparing the M7.0 earthquake and M8.0 earthquake in Figure 8, it is found that has no stratification, which also indicates the magnitude saturation of . But the specific saturation magnitude needs the further study to determine.
In order to study the stability and accuracy of the method, the method is chosen to compare with it. The fitting models of the method and method are shown in Equations (10) and (11). Among them, the arrival time of P waves is extracted by the manual supervision method, the short window length is set as 0.3 s, and the long window length is set as 3 s. In the method, the high pass filter for integrating displacement is set as the second-order high pass Butterworth filter (the low-frequency cut-off frequency is 0.025 Hz), since the value determined by the first 3 s P waves cannot be used for M ≥ 6.7 earthquakes [13], and considering the accuracy of the algorithm, the time window for calculating value is set as 4 s.
where A, B, and C are the coefficients to be fitted. A large number of studies have shown that when the earthquake energy reaches a certain degree, the magnitude saturation phenomenon will occur. By comparing the M7.0 earthquake and M8.0 earthquake in Figure 8, it is found that P SNR has no stratification, which also indicates the magnitude saturation of P SNR . But the specific saturation magnitude needs the further study to determine.
In order to study the stability and accuracy of the P SNR method, the P d method is chosen to compare with it. The fitting models of the P d method and P SNR method are shown in Equations (10) and (11). Among them, the arrival time of P waves is extracted by the manual supervision method, the short window length is set as 0.3 s, and the long window length is set as 3 s. In the P d method, the high pass filter for integrating displacement is set as the second-order high pass Butterworth filter (the low-frequency cut-off frequency is 0.025 Hz), since the P d value determined by the first 3 s P waves cannot be used for M ≥ 6.7 earthquakes [13], and considering the accuracy of the algorithm, the time window for calculating P d value is set as 4 s.
where A, B, and C are the coefficients to be fitted. The study of Zollo shows that the P d method also has a saturation phenomenon [24]. When the time window length is 4 s, the saturation magnitude can reach M7.0. Therefore, the M ≤ 7.0 earthquakes in the samples are compared and analyzed by P d method and P SNR method in this study, as shown in Table 1. The fitting equation by P SNR method is M = −4.6912 + 4.2519logP SNR + 3.8137logR, and the fitting correlation coefficient reaches 0.8012, which conforms to the linear relationship. The fitting equation by P d method is M = −1.2729 + 1.3405logP d + 5.4202logR, and the fitting coefficient is 0.7552, which conforms to the linear relationship. As can be seen from Table 1, the R 2 statistic of P SNR is slightly larger than that of P d , and the mean residual of the two methods are also roughly the same, which represents the high accuracy and stability of this method. Figure 9 shows the residual diagram of the two methods. From the discreteness of the residuals, the residuals of the two methods are distributed around 0, with only a few outliers. It can be seen that the fitting results of the two methods are good. to the linear relationship. As can be seen from Table 1, the 2 statistic of is slightly larger than that of , and the mean residual of the two methods are also roughly the same, which represents the high accuracy and stability of this method. Figure 9 shows the residual diagram of the two methods. From the discreteness of the residuals, the residuals of the two methods are distributed around 0, with only a few outliers. It can be seen that the fitting results of the two methods are good.  After the fitting model is obtained, the accuracy of the model is tested by detecting several groups of seismic events. Table 2 shows the test results. N is the number of stations involved in each event.
is the actual magnitude. is the estimated magnitude. In each group of earthquake events, the value and hypocentral distance obtained by effective stations are brought into the model, and the magnitude estimation results of each station are obtained. Finally, the average value is the magnitude estimation result of the earthquake event, which compensates for possible site effection. Each seismic event can roughly estimate the magnitude of the earthquake through only several stations, and these effective stations are close to the source, which also makes the magnitude quickly obtained through close stations when the earthquake occurs.  After the fitting model is obtained, the accuracy of the model is tested by detecting several groups of seismic events. Table 2 shows the test results. N is the number of stations involved in each event. M a is the actual magnitude. M e is the estimated magnitude. In each group of earthquake events, the P SNR value and hypocentral distance obtained by effective stations are brought into the model, and the magnitude estimation results of each station are obtained. Finally, the average value is the magnitude estimation result of the earthquake event, which compensates for possible site effection. Each seismic event can roughly estimate the magnitude of the earthquake through only several stations, and these effective stations are close to the source, which also makes the magnitude quickly obtained through close stations when the earthquake occurs.  Figure 10 shows the variation of the estimated magnitude M e with the number of the stations N in the xingwen M5.7 event. With the increase in the N, the Me estimated by P SNR is more and more equal to the actual magnitude M a . In the EEW with the dense sensor network, it is possible to obtain the more accurate magnitude by extracting the characteristic parameter P SNR from the multiple sensors for estimation and averaging. Figure 10 shows the variation of the estimated magnitude with the number of the stations N in the xingwen M5.7 event. With the increase in the N, the Me estimated by is more and more equal to the actual magnitude . In the EEW with the dense sensor network, it is possible to obtain the more accurate magnitude by extracting the characteristic parameter from the multiple sensors for estimation and averaging. In terms of timeliness, the time of in all sample data are counted, as shown in Figure 11. Each interval of the abscissa in the histogram is the time range after the arrival of P waves. Most of the time corresponding to the ranges from 0-0.3 s, which is because the length of the short-time windows is 0.3 s, and there is no additional P waves' power in the long-time windows. In this time range, the is most likely to appear, which indicates the strong timeliness of the method. A few times range from 0.3-2 s. It can be determined that the occurrence time of value is within 2 s after the arrival of P waves, but the concrete time is still not certain. The process of fault rupture is very complex. The energy of the small earthquakes is small, and the duration is short. The energy of the large earthquakes is strong, and the duration of seismic waves is long. Even for the same earthquake, due to the inherent noise of the instrument and the local geological conditions, the determination time of value is slightly different. The method has better timeliness, which can greatly save costs and greatly reduce the time of magnitude estimation. In terms of timeliness, the time of P SNR in all sample data are counted, as shown in Figure 11. Each interval of the abscissa in the histogram is the time range after the arrival of P waves. Most of the time corresponding to the P SNR ranges from 0-0.3 s, which is because the length of the short-time windows is 0.3 s, and there is no additional P waves' power in the long-time windows. In this time range, the P SNR is most likely to appear, which indicates the strong timeliness of the P SNR method. A few times range from 0.3-2 s. It can be determined that the occurrence time of P SNR value is within 2 s after the arrival of P waves, but the concrete time is still not certain. The process of fault rupture is very complex. The energy of the small earthquakes is small, and the duration is short. The energy of the large earthquakes is strong, and the duration of seismic waves is long. Even for the same earthquake, due to the inherent noise of the instrument and the local geological conditions, the determination time of P SNR value is slightly different. The P SNR method has better timeliness, which can greatly save costs and greatly reduce the time of magnitude estimation.    Figure 12 shows two examples of P SNR values in 0-0.3 s and 1.5-1.8 s after P waves' arrival, the arrival time of P waves, P SNR and P d are also shown in the figure. In the first example (a, b, c, d), after the arrival of P waves, the STP/LTP value immediately increased to the maximum, and the P SNR value quickly appeared. In the second example (e-h), the STP/LTP value increases after the arrival of P waves, but it increases to the maximum after a period of time. Although the occurrence time of P SNR is different between the two examples, it is much earlier than the P d method. With the comprehensive consideration of timeliness and accuracy, the P SNR method has significant advantages. The magnitude estimation can be carried out synchronously when P waves arrives, which greatly improves the timeliness of earthquake early warning system. However, P SNR requires high accuracy for P waves' arrival extraction. If P waves' seismic phase identification is wrong, this method will also result in a false alarm.  After analyzing the accuracy and timeliness of P SNR algorithm, it can be seen that P SNR can synchronize the extraction of P waves' arrival time for magnitude estimation in the initial short time of P waves. P SNR is suitable for the construction of earthquake early warning system in terms of timeliness, accuracy, and robustness.

Discussion
The fast magnitude estimation method (P SNR ) based on SNR feature proposed in this paper is a new method in the field of magnitude estimation. The significance of this study is that the P SNR method can quickly estimate the magnitude in a short time; in particular, the magnitude estimation time is controlled within two seconds after the arrival of the P waves, which greatly meets the timeliness of the earthquake early warning system. Compared with the existing magnitude estimation methods, the new method greatly reduces the time used for magnitude estimation and improves the efficiency of earthquake early warning, which is the main highlight of the P SNR method.
The P SNR method extends the advantages of the STP/LTP method and extends from the time-of-arrival extraction of P waves to the magnitude estimation, so that the magnitude estimation can be synchronized with the extraction of P waves, which is the cleverness of the P SNR method.
With the development of sensor technology and computer technology, the network of seismic monitoring stations will be more and more intensive. Under such technical background, the efficiency of earthquake early warning will be significantly improved. Fortunately, the calculation cost of P SNR method is low. After the P waves are extracted by STP/LTP method, it is only necessary to find the P SNR value, without excessive calculation, which can effectively reduce the pressure of the single chip microcomputer at the equipment end. Based on the mode of cloud-edge collaboration, in the earthquake early warning system, the edge equipment can directly record the P SNR value and transmit it to the cloud server, which also greatly reduces the transmission pressure of the network and the calculation pressure of the cloud server.
The P SNR method is more robust than the existing methods, which can be applied to weak noise, general noise environment, and is not easily affected by instrument background noise. The P SNR parameter performance is very stable in a weak noise environment. Moreover, the P SNR method has the advantage of dimensionless, which can be widely used in different types of station instruments and improving the efficiency of data processing. P SNR can be obtained directly from the measuring units of the instruments used for different specifications. In the station data of this study, the instrument specifications are not completely uniform, the use of the P SNR method greatly saves the cost of data processing and avoid the calculation error caused by different units.
It should be noted that the geological structure and crustal movement are different in different regions. All earthquake events in this paper are shallow earthquakes. When the P SNR parameter is used to estimate the magnitude, local historical records should be used for model training so as to improve the accuracy of the model and reduce the false alarm rate.
In addition, the factors affecting the P SNR value cannot be ignored. The premise of obtaining P SNR is to detect the P waves accurately. Many research methods have achieved good results in P waves' detection, such as the STP/LTP method [21], the AIC method [25], and the deep learning method [26]. The length of the long-time window and short-time window in sliding window also has a certain influence on P SNR value. If the length of the short-time window is too short, there will be noise interference. If the length of the short time window is too long, the seismic effective energy cannot be expressed in time. Finally, the more stable the sensor performance for seismic monitoring is, the more accurate and stable the P SNR value and the accuracy of the fitting model are.

Conclusions
Aiming at the timeliness and accuracy of a magnitude estimation in an earthquake early warning system through analyzing the energy characteristics of the STP/LTP method and combining the principle of SNR and the definition of relative power, a P waves arrival fast magnitude estimation method (P SNR ) based on SNR is proposed in this paper. The main conclusions are as follows: (1) Both ghd P SNR method and P d method have high stability and accuracy, and the P SNR method has strong robustness. (2) The highlight is that the P SNR method has good timeliness. The time corresponding to P SNR value is usually within 2 s from the first arrival of P waves, and sometimes it can even be synchronized to the first arrival of P waves, which can greatly save time in the earthquake early warning magnitude estimation. P SNR is a good choice that considers both timeliness and accuracy. (3) The STP/LTP method based on SNR and relative power contains certain energy information when seismic P waves arrive. There is a certain positive correlation between P SNR value and magnitude, and there is an obvious attenuation relationship between P SNR value and hypocentral distance R. (4) Owing to the dimensionless characteristics, the P SNR method can be widely used in different sensors and reduce costs in the processing of seismic records.
In all, P SNR method can meet the needs of the EEW in terms of timeliness and accuracy.