Python software to transform GPS SNR wave phases to volumetric water content

The global navigation satellite system interferometric reflectometry is often used to extract information about the environment surrounding the antenna. One of the most important applications is soil moisture monitoring. This manuscript presents the main ideas and implementation decisions needed to write the Python code to transform the derived phase of the interferometric GPS waves, obtained from signal-to-noise ratio data continuously observed during a period of several weeks (or months), to volumetric water content. The main goal of the manuscript is to share the software with the scientific community to help users in the GPS-IR computation.

The primary technique is to use continuous SNR observables for satellites tracks between 5 and 30 elevation angles and convert the SNR observed in dB-Hz units to a linear scale in volts. Then, the reflected signal is isolated by fitting a second-order polynomial to the SNR (in volts) to eliminate the direct satellite signal, and finally, the reflected signal is modeled assuming a sinusoidal behavior, using the following expression: where A and ϕ are the amplitude and phase of the wave, λ is the GNSS signal wavelength, e is the satellite elevation. h is the reflector height, which is the vertical distance between the GNSS antenna phase center and the horizontal reflecting surface, which is assumed to be the distance between the antenna and the floor due to the low signal penetration on the ground.
However, some precautions are needed to ensure good results: (1) rising or setting satellite tracks should be separated (or tagged for the post-processing), since the (1 interferogram pattern can differ for rising and setting tracks of the same satellite; (2) Lomb-Scargle periodogram should be computed from the reflected SNR of each satellite track in order to check that only a clear primary wave is observed, that is, tracks with multiple peaks or low maximum average power should be discarded; (3) finally, a good adjustment (with low residuals) between the SNR indirect signal and the sinusoidal wave is needed to consider a track to be valid for a posteriori transformation to volumetric water content (VWC). The final step is the transformation of wave phase differences from day to day to VWC differences. To do this, in situ observations are needed as a reference data set. These observations can be obtained from soil data samples (Martin et al. 2020a) from conventional water content reflectometer sensors (Larson et al. 2010;Vey et al. 2016) or can be estimated based on the soil type . Several weeks (or months) of both types of data are necessary to obtain a good linear relationship between GNSS-IR-derived phase variations and reference VWC variations. Usually, a value of 65.1°/(m 3 /m 3 ) is used for this linear relationship, implying that a change of 1° in phase corresponds to a change of 0.015 m 3 /m 3 in volumetric water content. However, a better slope can be adjusted using the satellite tracks for which the phase variations present a stronger linear correlation with in situ soil moisture variations. This final step reduces the number of valid satellites that can be used in the final soil moisture monitoring because of the low correlation some satellites present with respect to the reference values. For example, in Zhang et al. (2017), this correlation is set at 0.9, so only the ascending tracks of GPS satellites 13, 21, 24, and 30 and the descending tracks of GPS satellites 05, 09, 10, 15, and 23 were used; in Vey et al. (2016), only GPS satellites 2, 8, 14, 17, 23, and 29 were used for the calculations.
Some GNSS-IR open software packages are provided to the scientific community. For example, in Nievinski and Larson (2014), a MATLAB/Octave software is developed, which can produce carrier phase, pseudorange and SNR simulated GPS observations that agree with a multipath model. In Roesler and Larson (2018), a software tool translates GPS (or GNSS) observations into a format usable for reflection research, estimates the dominant frequencies and reflection height, and generates a map of GNSS-IR reflection zones around the antenna.
In Martín et al. (2020b), a software package is presented to transform GPS SNR observations to indirect SNRadjusted waves, where the amplitude and phase of the waves for the good satellite tracks are the final output (https:// geode sy. noaa. gov/ gps-toolb ox/ pyGNSS-IR. htm). The software contains some to guarantee that only good indirect SNRadjusted waves are finally saved. This manuscript describes the final piece of software to complete the process, that is, to transform the adjusted phase of the good indirect SNR GPS waves (output of the previous software package) to daily VWC mean values. To accomplish this transformation, reference values are needed. GNSS observations and reference values are provided with the software to check the correct software execution. They are those reported in Martin et al. (2020a): continuous GNSS observations for 66 days, from December 3, 2018, to February 6, 2019, in the installations of the Cajamar Centre of Experiences, Paiporta, Valencia, Spain (https:// www. funda cionc ajama rvale ncia. es/ es/ comun/ activ idades/) and daily soil samples taken (except weekends) at 5 cm depth and weighed before and after being dried (gravimetric method) in a laboratory. Additionally, a reference file with daily raining values (in liters by day) is included for the final plot of the results.

Software development
This software is a continuation of the software tools GPS_ file.py and SNR_list_satV2.py (https:// geode sy. noaa. gov/ gps-toolb ox/ pyGNSS-IR. htm) coded in python (python 2.7 and 3 can be used), and the input is the output of the SNR_ list_satV2.py process.
Assuming that the output results of SRN_list_satV2.py software are stored in individual files for every satellite and observed week, the steps of the PhSNR2VWC.py software tool are as follows: 1. From every week output file containing the amplitude and phase for every satellite track, the software generates an internal file with the rising satellite tracks and another with the falling satellite tracks. 2. For both internal rising and falling files and satellite by satellite, the software transforms the adjusted phase to a value between 0 and 180 degrees using the sign of the adjusted amplitude so that all phases are located in a positive wave with positive correlation with respect to reference values. The phase is transformed to VWC using the linear relationship of 65.1°/(m 3 /m 3 ), and the user can modify this default value. 3. Mean GPS-derived VWC values per rising or falling track and satellite and day are computed. (This step is included in case a track was interrupted in the observation and two different parts of the same track were computed separately). 4. Outlier detection and elimination: GPS-derived VWC for a day greater or lower than 0.03 m 3 /m 3 (default value) in comparison with the previous or later one or two days is deleted. The user can modify this threshold because this value cannot be realistic in the case of strong rain conditions. 5. Since the results should be interpreted in a relative way, that is, water content variations from one day to another, the GPS-derived VWC is reduced to reference data. This is done by computing and applying the offset between the mean GPS-derived VWC values and mean reference values. After this, if a GPS-derived VWC value is below 0.05 m 3 /m 3 (Vey et al. 2016) or higher than 0.05 m 3 /m 3 plus the maximum reference value, it is eliminated. 6. Only satellites with more than 20% of GPS-derived VWC daily values, in comparison with the total observed days, are finally stored (this percentage is per falling or rising track since they are separated in the computation). 7. Only satellites with correlations higher than 0.6 with respect to the reference values are taken for the next step. This correlation value can be modified by the user. 8. Mean GPS-derived VWC daily values are computed using all satellites stored in the previous step. In this step, all falling and rising values are used together.

Software example
The data we provided with the software are part of an experiment performed in the installations of the Cajamar Center of Experiences, Paiporta, Valencia, Spain, by Martín et al. (2020a). The experiment was performed from December 3, 2018 to February 6, 2019. We provide the output files of SNR_list_satV2.py for every one of the ten observed weeks. Additionally, a reference file with the daily soil samples reduced by the gravimetric method and a file with the rain values are provided. The output of PhSNR2VWC.py is shown in Fig. 1, where the daily-GPS-derived VWC values, reference values and rain values are plotted, VWC values are also saved in an output file. In the prompt of the Python console, information about the correlation for every satellite (separated by rising or falling tracks) with respect to the reference values is shown and, also, information about whether a satellite (separated by rising or falling tracks) has not been considered because lower than 20% of the total days are good values. Finally, a statistical summary containing the Pearson correlation, root mean square error (RMSE) and mean absolute error (MAE) between GPSderived VWC and reference values is also provided in the prompt. Table 1 presents those statistical values for the example included with the software.

Conclusions and final remarks
This manuscript presents the main ideas and implementation decisions needed to write the Python code to transform the derived phase of the interferometric GPS waves, obtained from signal-to-noise ratio (SNR) data continuously observed during a period of several weeks (or months), to volumetric water content (VWC). The main intention is to share the software with the scientific community to help users in GNSS-IR computation.
Based on our results, it is important to highlight that, according to the results of SNR_list_satV2.py software, approximately 50% of all the satellite tracks can be considered good tracks for interferometric reflectometry. Based on the results of the PhSNR2VWC.py software, considering all satellite tracks and all the observation periods (66 days in this example), only 17% can be considered good satellite tracks for all the days of the experiment and therefore can be used to monitor VWC with good accuracy. Thirty percent are under the 20% of all observed days, 33% present a correlation below 0.6, and the other 20% are considered as satellite tracks with insufficient satellite information (no good tracks obtained from the output of the SNR_list_SatV2.py software). This means that only a small part of all GPS observations can be used, so the next step is to introduce other satellite constellations in the solution (GLONASS, Beidou and/or Galileo).  Acknowledgements The authors want to thank the Cajamar Center of Experiences staff for their support and collaboration in the Paiporta experiment. The authors also want to thank anonymous referees for their valuable comments and suggestions.
Funding Open Access funding provided thanks to the CRUE-CSIC agreement with Springer Nature.

Data Availability
The software is available from the GPS Toolbox website at https:// geode sy. noaa. gov/ gps-toolb ox/ Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.