# Successful Tests on Detecting Pre-Earthquake Magnetic Field Signals from Space
## 2 Materials and Methods
### Analysis and Magnetic Field Satellite Anomaly Definition  
In this analysis, all magnetic field X (north), Y (east), Z (vertical), and total intensity F measurements (in the figures, the components are also indicated as Bx, By, and Bz) with a 1 Hz sampling rate and level 1-b are used. As a first step and according to the magnitude of each earthquake, the magnetic field vector data were downloaded from the Swarm satellite website ([[https://earth.esa.int/eogateway/missions/swarm/data](https://earth.esa.int/eogateway/missions/swarm/data)]([https://earth.esa.int/eogateway/missions/swarm/data](https://earth.esa.int/eogateway/missions/swarm/data)) (accessed on 2 July 2024)). The area of interest for data preparation for each event was estimated in the Dobrovolsky area, i.e., using Equation (1). For each earthquake, all the satellite orbits that crossed the Dobrovolsky region from 10 days before the earthquake to the day of its occurrence are analyzed. First, we obtain the first-time derivative of each path. This operation removes most of the slow fluctuations of the magnetic signal. A best-fit curve, adjusted using the cubic-spline algorithm with 6 s node points, is applied to the tracks and subtracted from the time series. The resulting residuals are plotted and then analyzed. The scale is kept constant within a range of \(\pm\)2 nT to facilitate the comparison of residuals across different tracks. These residuals are highly sensitive to any sudden change in the original signal [42]. Once we obtained the residuals, a conventional automatic algorithm usually applied in seismology was here used to detect magnetic anomalies. The most widely utilized algorithm in weak-motion seismology is the \"short-time-average through long-time-average trigger\" (STA/LTA; e.g., [43]). This algorithm continuously calculates the average absolute amplitude of a seismic signal within two consecutive moving-time windows. The short time window (STA) is sensitive to seismic events, while the long-time window (LTA) provides information about the temporal amplitude of seismic noise at the specific site. An event is considered \"declared\" when the ratio between the two exceeds a predetermined value. In this study, we employed this algorithm to identify anomalies in the magnetic field vector. Specifically, we used an LTA of 50 s and an STA of 5 s, and set the pre-set STA/LTA value to 3. After identifying orbits displaying magnetic anomalies, we employed the STA/LTA algorithm to assess the length of these anomalies. In the subsequent step, we estimated the duration of the time windows containing anomalies and calculated the ratio of the anomaly's energy to that of the entire time series. Additionally, we considered the signal-to-noise ratio to account for data quality and the anomalies identified. To calculate the signal-to-noise ratio, we divided the mean squared amplitude of the anomaly by the mean squared amplitude of the entire signal. Finally, we examined the resulting designs to identify obvious anomalies with the following characteristics [42]:  
1. The peak-to-peak amplitude is \(\geq\)0.3 nT. 2. Anomalies should last for at least ten seconds. Determine if the anomalies did or did not occur during times when geomagnetic indicators were in quiet conditions. Ionospheric parameters are influenced by solar activities. Geomagnetic indices such as Kp, Dst, and F10.7 are measured to quantify the level of solar activity. Usually, geomagnetic perturbations have less penetration in middle latitudes. The criterion of the quietness of geomagnetic indices is usually (F10.7 \(\leq\) 150, Kp \(\leq\) 3, \(\mid\)Dst\(\mid\)\(\leq\) 20 nT) [44; 45].