Skip to main content
Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

Development of long short-term memory models using rainfall and soil moisture to predict soil moisture dynamics

  • Yoon Ji Kim,

    Roles Conceptualization, Data curation, Investigation, Methodology, Project administration, Visualization, Writing – original draft, Writing – review & editing

    Affiliations Department of Horticulture, Chonnam National University, Gwangju, Republic of Korea, Interdisciplinary Program in IT-Bio Convergence System, Chonnam National University, Gwangju, Republic of Korea

  • Ho Jin Im,

    Roles Formal analysis, Software, Validation

    Affiliation Department of Statistics, Chonnam National University, Gwangju, Republic of Korea

  • Seung Gon Wi,

    Roles Funding acquisition, Supervision

    Affiliation Digital Agriculture Research Institute for Horticultural Fruit, Chonnam National University, Gwangju, Republic of Korea

  • Min Soo Kim,

    Roles Formal analysis, Supervision, Validation

    Affiliation Department of Statistics, Chonnam National University, Gwangju, Republic of Korea

  • Seok Min Lee,

    Roles Supervision

    Affiliation Gyeongsangnam-do Agricultural Research and Extension Services, Jinju, Republic of Korea

  • Ung Yang,

    Roles Writing – review & editing

    Affiliation Pear Research Center, National Institute of Horticultural & Herbal Science, Rural Development Administration, Naju, Republic of Korea

  • Sun Woo Chung ,

    Roles Supervision, Writing – review & editing

    sunwchung@jnu.ac.kr (SWC); pear@jnu.ac.kr (SHL)

    Affiliations Department of Horticulture, Chonnam National University, Gwangju, Republic of Korea, Interdisciplinary Program in IT-Bio Convergence System, Chonnam National University, Gwangju, Republic of Korea

  • Sang-Hyun Lee

    Roles Project administration, Resources, Supervision

    sunwchung@jnu.ac.kr (SWC); pear@jnu.ac.kr (SHL)

    Affiliations Department of Horticulture, Chonnam National University, Gwangju, Republic of Korea, Interdisciplinary Program in IT-Bio Convergence System, Chonnam National University, Gwangju, Republic of Korea, Digital Agriculture Research Institute for Horticultural Fruit, Chonnam National University, Gwangju, Republic of Korea

Abstract

Long short-term memory (LSTM) models were developed using rainfall and soil moisture data to predict soil moisture at various depths in an Asian pear orchard. Two types of rainfall inputs were tested: hourly rainfall data treated as individual values and event-based rainfall data, where cumulative rainfall was calculated by applying the minimum inter-event time threshold (12 h). Soil moisture was measured at depths of 20, 40, and 60 cm from the soil surface during 2023 and 2024 using frequency domain reflectometry. The models were trained to predict soil moisture at time horizons of ‘t + 1’, ‘t + 3, ‘t + 6’, and ‘t + 12’ when ‘t’ is present time. Short-term predictions more accurately followed the observed soil moisture trends than long-term predictions. During the collection period, rainfall varied from 0.5 mm to 48.5 mm per hour. Soil moisture contents increased immediately following the onset of rainfall. These results are consistent with existing knowledge. As soil depth increased, soil moisture contents tended to increase and respond more gradually to rainfall. During rainfall, in the topsoil (20 cm depth) moisture content fluctuated significantly, while the subsoil (60 cm depth) remained relatively stable for several hours after rainfall ended. The model performance was evaluated using mean absolute error, root mean square error (RMSE), and normalized RMSE values. In both models using hourly and event-based rainfall inputs, errors in soil moisture prediction tended to increase with longer forecast time horizons. However, these errors were significantly lower when using event-based rainfall data. These findings indicate that event-based rainfall is a more effective input for LSTM models in predicting soil moisture in an Asian pear orchard, and such models can support precision irrigation systems that optimize water use by delivering the right amount of water at the right time.

Introduction

Soil moisture, the amount of water contained in unsaturated soil zone, is a crucial factor in land-atmosphere interactions [1,2]. It plays a key role in determining crop yield and quality [36] and is closely linked to many crop stresses such as heat and drought [7]. In open fields, soil moisture fluctuates significantly with changing weather conditions, as rainfall directly influences soil moisture content [8,9]. Accurate measurement and prediction of soil moisture are essential for effective irrigation planning, enabling water application to crops at optimal times and quantities, and improving crop water use efficiency [10].

Methods for measuring soil moisture have advanced significantly over time. The gravimetric method, which directly measures the weight of moisture in soil samples, is accurate but impractical for regional-scale assessments due to its labor-intensive and time-consuming nature [11]. To overcome these limitations, indirect methods using dielectric constant sensors have been developed, which estimate volumetric moisture content by measuring soil permittivity, electrical conductivity, charge storage capacity, or transit time. Time-domain reflectometry is a less invasive but relatively expensive method [12]. Frequency domain reflectometry (FDR), which operates with lower-frequency sensors, is more affordable, simpler, and requires less energy, however it is more susceptible to confounding factors such as temperature, salinity, electrical conductivity, and soil texture [13].

Due to its substantial spatiotemporal variability, soil moisture has been estimated using various methods. One approach uses Richards’ equation, which combines Darcy’s law with the energy balance principle [14]. However, equation-based models can be computationally intensive [15]. Statistical models predict quantities based on patterns learned from historical data. More recently, machine learning and deep learning algorithms have been employed to construct mathematical models that extract information from training datasets and covariates [16]. These approaches are also designed to handle diverse and large datasets, making them potentially valuable tools for operational water management [17].

Long short-term memory (LSTM), a type of machine learning algorithm, has demonstrated excellent performance in time series forecasting, as shown in numerous studies [1820]. Its architecture was specifically designed to address the long-term gradient vanishing problem in recurrent neural networks (RNN) [21]. The gating mechanism in LSTM enables it to retain or discard information over long sequences, allowing it to learn efficiently from extensive and variable soil moisture datasets and to recognize temporal patterns [22,23]. Furthermore, it can accurately simulate complex nonlinear interactions between variables [24].

Meteorological variables have long been used to predict soil moisture in previous studies [25]. For example, Dolaptsis et al. [26] developed an LSTM model to predict daily reductions in soil moisture content in two maize fields in Turkey, using weather data such as average daily air temperature, total daily solar radiation, average daily relative humidity, and leaf area index. However, models including numerous variables and extensive computations in open-field orchards have a number of practical restrictions that must be considered. Removing some predictors can lead the model to incorrectly weight irrelevant variables, reducing prediction accuracy [27]. Since it is often challenging for growers to consistently collect high-quality data, models should require only a limited number of relevant variables. Furthermore, computational cost must remain low for smart farming technologies to be accessible in both developed and developing countries [28].

In commercial orchards, rainfall provides a significant amount of water supply to the soil and is the primary factor influencing soil moisture dynamics [29]. Hourly rainfall is commonly used as an input variable in modeling [30]. However, individual rainfall event differs in volume, duration, intensity, and the interval between occurrences [31]. Soil moisture responds to the cumulative effect of rainfall, and this response depends on specific characteristics of each event. Therefore, cumulative rainfall may be a more effective input variable in soil moisture prediction models. To better understand how individual rainfall events affect soil moisture, it is essential to segment continuous rainfall records into discrete events.

To the best of our knowledge, there has been minimal study on how to adequately account for rainfall when developing machine learning models that predict soil moisture only on rainfall and soil moisture. We hypothesized that using cumulative rainfall as a meteorological input variable could improve the performance of LSTM models in predicting soil moisture. Therefore, the objectives of this study are as follows: (i) Develop an LSTM model with only rainfall and soil moisture data. (ii) Compare each’s performance with hourly rainfall data and event-based rainfall data as input values. Our findings compared two models designed to forecast soil moisture changes across various time horizons, which enables growers to manage freshwater resources more efficiently and achieve significant economic benefits.

Materials and methods

Study area and soil moisture measurements

Soil moisture was determined at a commercial Asian pear orchard located in Naju, Korea (34°58’34.1”N, 126°42’12.7”E).. The slope of surface of study area is 7.5˚ increase. Corresponding author Prof. Sang-Hyun Lee, Director of the Digital Agriculture Research Institute for Horticultural Fruit, was designated as the agricultural manager in the study site, therefore no further permit was required. Data were collected from April to October to focus on the effects of rainfall, excluding potential effects of snow and frost during winter. Topsoil (15–30 cm depth from the soil surface) and subsoil (30–60 cm depth) in the study area are classified as silt loam and silty clay loam, respectively. The soil database collected by the Korean Soil Information System (https://soil.rda.go.kr) was used to compile this soil information, based on granulometric analyses conducted utilizing hydrometer methods.

Soil sampling process for the hydrometer method was conducted as follows. Samples were taken with three replicates in a grid pattern within one-third of the plot area, excluding orchard boundaries and areas compacted by agricultural machinery. Topsoil samples were taken by removing 5 cm from the surface, while subsurface samples were collected 5 cm below the cultivation layer with three replicates collected for each soil layer. Soil samples were air-dried, passed through a 2 mm sieve, oven-dried at 105°C for 18 hours, and weighed to obtain a 50 g sample.

Study area is located in Naju, Korea (34°58’34.1”N, 126°42’12.7”E).

Soil moisture data were recorded separately at depths of 20, 40, and 60 cm from the soil surface at 5-min intervals using frequency domain reflectometry-type soil sensors (RS-ECTH-N01-TR-1, Renke, Sandong, China). Observations were conducted from April to October, 2023 and 2024. During the data collection period, 15,240 soil moisture and 5,136 rainfall data points were collected in 2023, compared with 14,657 and 5,136 data points, respectively, in 2024

Hourly rainfall data for the same periods were obtained from the automatic weather stations operated by the Korea Meteorological Administration (https://www.weather.go.kr). Hourly rainfall data were obtained using a 20-cm diameter tipping-bucket rain gauge, which measures precipitation in 0.5 mm increments.

Data processing

Cumulative rainfall per event was calculated by applying a minimum inter-event time (MIET) of 12 h to the rainfall dataset. The MIET represents the minimum rain-free period required to distinguish individual rainfall events within a continuous record (Fig 1). According to Lee and Chung [32], a duration of 11–12 h was sufficient to establish rainfall independence. If the gap between two rainfall records was less than 12 h, they were considered part of the same event. If the interval exceeded 12 h, they were treated as separate events.

thumbnail
Fig 1. A graphic representation of the minimum inter-event time (MIET).

https://doi.org/10.1371/journal.pone.0353268.g001

defined as the minimum rain-free period required to distinguish individual rainfall events within a continuous dataset. If there are 12-hour intervals between rainfall records, they are separated as distinct events; if not, they are grouped together into containers as a single event.

LSTM model for predicting soil moisture

LSTM, a type of RNN, includes memory blocks composed of cells with self-connections that store the temporal state of the network, along with gates (multiplicative units) that regulate the flow of information [33]. Fig 2 and the equations 16 show the structure of LSTM, and the equations have a role in each gate [34]. S1 file presents the results of soil moisture prediction using Support Vector Machine and Random Forest, compared to LSTM prediction. This architecture, which determines whether to forget, add, or store information, makes LSTM particularly well-suited for processing time series data [35,36].

(1)(2)(3)(4)(5)(6)

Where is the output from the forget gate, is the preceding step, is the current input value, and is a constant bias value. Input gate is consists of two layers. is whether the value needs to be updated or not, is a vector of new values that will be added into the LSTM memory. The output gate calculates the final output, where is the output value, and is its representation as a value between –1 and 1. , , , and are weight matrices.

The preceding step () and the current input value () are consecutively sent through the sigmoid and tanh layers into the forget gate (, input gate ( and ), and output gate ().

To remove data noise and facilitate effective model learning, all input and output variables were scaled to a range [0, 1] using the MinMaxScaler (https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html).

Hyperparameters are selected before LSTM is performed. Grid search optimization is a common method for tuning the parameters of ML classification algorithms, searching exhaustively for the optimal configuration in a predetermined set of hyperparameters as a decision-theoretic method [37,38]. The information on hyperparameters found through grid search is provided in Table 1. Window size, hidden size, num layers, batch size, learning rate were included. The window size is the number of prior time steps supplied into the model at once, indicating how much historical information the LSTM uses to create predictions. Hidden size refers to the dimensionality of the LSTM’s hidden state, which represents the model’s ability to retain and comprehend temporal patterns. Num layers is the number of stacked LSTM layers that determine the depth of sequential feature extraction. Batch size is the number of training samples handled concurrently in a single optimization step. The learning rate is the step size used to update model parameters during training, which determines the speed and stability of convergence. A sensitivity analysis of hyperparameters was conducted. Optimization parameters, such as the learning rate, exhibited relatively clear optimal values regardless of the forecasting time horizon. However, structural parameters, such as the window Size, exhibited contrasting trends depending on the forecasting time point. The preference for small window sizes in event-based rainfall long-term predictions is that, given the physical response time of soil moisture, excessive previous data might behave as noise, raising forecast uncertainty. The number of model input variables was adjusted according to the window size, using two variables: previous soil moisture values and either hourly rainfall or event-based rainfall.

thumbnail
Table 1. Hyperparameters for estimating soil moisture.

https://doi.org/10.1371/journal.pone.0353268.t001

Hourly rainfall and event-based rainfall are either raw data collected in AWS at 1-hour intervals, or data classified as different rainfall events by MIET, which classifies 12-hour periods of no rainfall between rainfall records as different events after cumulative sum processing. The window size is the number of prior time steps supplied into the model at once, indicating how much historical information the LSTM uses to create predictions. Hidden size refers to the dimensionality of the LSTM’s hidden state, which represents the model’s ability to retain and comprehend temporal patterns. Num layers is the number of stacked LSTM layers that determine the depth of sequential feature extraction. Batch size is the number of training samples handled concurrently in a single optimization step. The learning rate is the step size used to update model parameters during training, which determines the speed and stability of convergence.

The training dataset was split into train 1 and train 2 as follows: train 1 from April 1, 2023, to October 31, 2023, and train 2 from April 1, 2024, to May 10, 2024. Data from May 11, 2024, to June 15, 2024, were used for validation. The test dataset was divided into two parts: test 1 from June 16, 2024 to August 16, 2024, and test 2 from August 23, 2024 to October 31, 2024.

‘t’ stands for the present, and the model inputs include rainfall data and prior soil moisture data, with the goal of predicting soil moisture at four forecast time horizons ‘t + 1’ (i.e., 1 h ahead), ‘t + 3’, ‘t + 6’, ‘t + 12’. Hourly rainfall data and event-based rainfall data were used as input variables for the model, respectively, and the prediction performance of the constructed model was compared.

Model evaluation

Model performance in predicting soil moisture was evaluated using mean absolute error (MAE), root mean square error (RMSE), and normalized RMSE (nRMSE), calculated as follows:

(7)(8)(9)

where is the total number of observations, and are the observed and predicted values for the th observation, respectively, and and are the maximum and minimum observed values, respectively.

The MAE represents the average of the absolute distance between the observed and predicted values, while the RMSE and nRMSE reflect the average magnitude of these difference, giving greater weight to larger errors [39]. Lower MAE, RMSE, and nRMSE values indicate better model performance, signifying a closer fit to the observed data and more accurate predictions.

Results

Rainfall and soil moisture

Hourly rainfall, event-based rainfall, and soil moisture content were monitored in both 2023 and 2024 (Fig 3) in an Asian pear orchard. Total rainfall from April to October was 1,679.5 mm in 2023 (Fig 3A) and 844 mm in 2024 (Fig 3B). The highest hourly rainfall in 2023 was 48.5 mm, recorded on June 28. During the 2024 monitoring period, the highest hourly rainfall of 27 mm recorded on September 21. The number of rainfall events was 47 in 2023 (Fig 3C) and 49 in 2024 (Fig 3D). A notable rainfall event of 248.5 mm was recorded over 96 h beginning on July 14 in 2023 (Fig 3C), with frequent rainfall events from late June through late July (Fig 3C and 3D).

thumbnail
Fig 3. Hourly rainfall, event-based rainfall, and soil moisture in 2023 and 2024.

https://doi.org/10.1371/journal.pone.0353268.g003

Hourly rainfall data (a, b) were collected at 1-h intervals from an automatic weather station located near the orchard. Event-based rainfall data (c, d) were identified using the minimum inter-event time (MIET) criterion. Hourly soil moisture content at depths of 20, 40, and 60 cm (e, f) below the surface in 2023 (a, c, e) and 2024 (b, d, f) is represented by solid line, dotted lines, respectively. There was more rainfall in 2023 than in 2024. Soil 60 cm depth holds more water than soil 20 cm depth.

Table 2 shows the soil texture analysis. The topsoil (15–32 cm) was silt loam, consisting of 55.3% silt and 26.9% clay. As the depth increased to the subsoil (32–64 cm), the soil texture shifted to silty clay loam, with clay content increasing to 27.8% and sand content decreasing to 13.5%.

Soil moisture contents increased immediately following the onset of rainfall (Fig 3E and 3F), reflecting the cumulative effects of successive hourly rainfall events. As soil depth increased, soil moisture responded more gradually to rainfall. In the topsoil (20 cm depth), moisture content fluctuated significantly, even in response to minor rainfall events. In contrast, moisture contents in the subsoil (60 cm depth) remained relatively stable for several days after rainfall ended. In addition, average soil moisture content tended to increase with the soil depth yielding 31.6%, 40.4%, and 51.4% at the 20, 40, and 60 cm depths, respectively.

Soil moisture prediction with LSTM models

LSTM models were developed using rainfall and soil moisture data to predict soil moisture at various soil depths in an Asian pear orchard. The train and validation phases results for 2023 and 2024 in three soil depths are presented in S2 fig, S3 fig, S4 fig, respectively. The performances of the models using hourly and event-based rainfall inputs were compared for predicting soil moisture at depths of 20 (Fig 4), 40 (Fig 5), and 60 cm (Fig 6) from the soil surface. The models were trained to predict soil moisture at various time horizons of ‘t + 1’, ‘t + 3, ‘t + 6’, and ‘t + 12’. The test dataset output varied depending on the type of rainfall input: hourly rainfall data without applying MIET versus event-based rainfall data with MIET, both combined with observed soil moisture data. Short-term predictions (‘t + 1’ and ‘t + 3’) more closely followed the observed soil moisture trends than long-term predictions (‘t + 6’ and ‘t + 12’). The hourly rainfall application model tended to produce false peaks in long-term forecasts, inaccurately predicting increases in soil moisture. These errors were significantly reduced when event-based rainfall data were used.

thumbnail
Fig 4. Observed and predicted soil moisture content at a depth of 20 cm.

The prediction system was evaluated at four forecast time horizons: ‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) the minimum inter-event time (MIET) or event-based rainfall data with MIET (b, d, f, h). Observed and predicted soil moisture contents are represented by solid and dotted lines, respectively. All comparisons were done over the test period. The model accurately represented temporal patterns at the ‘t + 1’ horizon, however forecasts at longer lead times (‘t + 6’ and ‘t + 12’) consistently underestimated soil moisture fluctuations. Furthermore, short-term spiky variations found in forecasts caused by hourly rainfall inputs (a, c, e, g) were significantly decreased when event-based rainfall data were employed (b, d, f, h).

https://doi.org/10.1371/journal.pone.0353268.g004

thumbnail
Fig 5. Observed and predicted soil moisture content at a depth of 40 cm.

The prediction system was evaluated at four forecast time horizons: ‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) the minimum inter-event time (MIET) or event-based rainfall data with MIET (b, d, f, h). Observed and predicted soil moisture contents are represented by solid and dotted lines, respectively. All comparisons were done over the test period. False sparks occurred most prominently. There was a tendency for overestimation in the event-based rainfall at ‘t + 3’ (c, d).

https://doi.org/10.1371/journal.pone.0353268.g005

thumbnail
Fig 6. Observed and predicted soil moisture content at a depth of 60 cm.

The prediction system was evaluated at four forecast time horizons: ‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) the minimum inter-event time (MIET) or event-based rainfall data with MIET (b, d, f, h). Observed and predicted soil moisture contents are represented by solid and dotted lines, respectively. All comparisons were done over the test period. Although false sparks were small, the model was not suitable for capturing the pattern of soil moisture increasing and then decreasing, notably over the extended prediction time horizon of ‘t + 12’.

https://doi.org/10.1371/journal.pone.0353268.g006

The model predicting soil moisture at a depth of 40 cm (Fig 5) exhibited the largest prediction error at the time horizon of ‘t + 1’ among all depths (Figs 4Fig 6). The false peaks observed in the model using hourly rainfall input were reduced in the model using event-based rainfall input. However, unlike at a depth of 20 cm (Fig 4), the model using event-based rainfall input at a depth of 40 cm tended to overestimate peak soil moisture during periods of increase (Fig 5). At a depth of 60 cm (Fig 6), false peaks were less frequent and less pronounced than at a depth of 20 (Fig 4) or 40 cm (Fig 5). However, at a depth of 60 cm, the model using event-based rainfall input was found to be ineffective for capturing the pattern of soil moisture increasing and then decreasing, particularly over the longer prediction time horizon of ‘t + 12’ (Fig 6).

Performances of LSTM models using hourly and event-based rainfall inputs

Table 3 shows the test period performances of LSTM models using hourly and event-based rainfall inputs for predicting soil moisture were evaluated across various time horizons using MAE, RMSE, and nRMSE values. S5 table shows the LSTM models’ performance results during the training phase.

thumbnail
Table 3. Performance comparison of LSTM models using hourly and event-based rainfall inputs in soil moisture prediction at various time horizons at different soil depths in an Asian pear orchard.

https://doi.org/10.1371/journal.pone.0353268.t003

In both models, the soil moisture forecasts at time horizon of ‘t + 1’ yielded the lowest MAE, RMSE, and nRMSE values. When predicting at ‘t + 1’, the highest RMSE values were observed at a depth of 20 cm depth and the lowest RMSE values were observed at a depth of 60 cm depth. Prediction errors increased with longer forecast time horizons, with the highest MAE, RMSE, and nRMSE values occurring at ‘t + 12’. Specifically, the MAE values for soil moisture forecasts at ‘t + 12’ were 1.22, 2.47, and 1.21% at depths of 20, 40, and 60 cm in test 1, respectively, using the hourly rainfall input. When using the event-based rainfall input, the corresponding MAE values were 1.50, 2.58, and 1.24%. Additionally, the RMSE values at ‘t + 12’ were 3.02, 4.44, and 2.37% at depths of 20, 40, and 60 cm, respectively, using the hourly rainfall input. When using the event-based rainfall input, the corresponding RMSE values were 3.10, 4.62, and 2.44%. Scatter plots at three soil depths are presented in S6 fig, S7 fig, and S8 fig.

When hourly rainfall data were used as model input, the prediction residuals at depths of 20 and 40 cm were lower at the shortest time horizon (‘t + 1’) compared to those obtained using the event-based rainfall data. However, at longer time horizons, the prediction residuals increased. At depths of 20 and 60 cm, the prediction residuals remained within an acceptable range relative to the sensor measurement error.

Discussion

Rainfall effects on soil moisture

In this study, the pattern of soil moisture increase following rainfall was found to vary with soil depth. This finding indicates that the effect of rainfall on soil moisture is not uniform, but depends on soil depth, consistent with the findings of Park et al. [23], who reported that although rainfall significantly influenced soil moisture, its impact differed by soil depth. This result could be explained from two perspectives. First, the topsoil and subsoil in the examined orchard are classified as silt loam and silty clay loam, respectively. Since clay holds more moisture than silt [40], differences in soil texture might affect water retention capacity. Second, the infiltration depth of rainwater is determined by rainfall intensity [41]. As the rainfall intensity increases, the amplitude of soil moisture variation also increases, in agreement with the findings of Chen et al. [42]. Additionally, in orchards, cultivation practices often loosen the surface soil, promoting more rapid water infiltration in the upper soil layers.

Performance comparison of LSTM models using hourly and event-based rainfall inputs

In the LSTM model, the RMSE tends to increase with the prediction horizon [43,44] presumably due to the characteristics of the input data. Both input variables were provided at 1-h intervals, thus the ‘t + 1’ prediction, which matches the input time step, showed the best performance. Additionally, while soil moisture responds to accumulated rainfall, hourly rainfall data reflect only the amount occurring within each hour. This can introduce learning errors, as the model may attempt to associate soil moisture changes with incomplete rainfall events. For example, an initial 1 mm of rainfall might have little impact on soil moisture, while an additional 1 mm, once rainfall has accumulated, can significantly increase in soil moisture. As a result, although the residuals between the models using the hourly and event-based rainfall inputs were not significantly different, the model using event-based rainfall input more accurately captured soil moisture peaks, as shown in Figs 4-Fig 6. These improved prediction abilities, particularly in recognizing dynamic soil moisture peaks, provide an algorithmic foundation for the use of smart irrigation systems. Smart irrigation has the ability to increase agricultural efficiency and decrease risks while reducing water waste by up to 95% [45]. The largest prediction residual was observed at a depth of 40 cm, presumably due to the influence of irrigation. As the rainfall data remained at zero, the irregular increases in soil moisture at the onset of irrigation may have contributed to higher prediction errors in the model.

Matei et al. [46] developed a real-time data mining system that collected weather data from ten weather stations to predict next-day soil moisture. The system used the measurements of air temperature, rainfall, and soil temperatures at three soil depths, and soil moisture at a depth of 10 cm. They applied the machine learning algorithms including k-nearest neighbor [47], support vector machine [48], neural networks [49], logistic regression [50], and fast large margin [51], achieving soil moisture prediction accuracies ranging from 64.4 to 74.4%. Similarly, Filipović et al. [52] developed an LSTM-based soil moisture prediction model using daily maximum and minimum temperatures, rainfall, and vapor pressure deficit. Tested on the data from 28 weather stations across Serbia having different soil types at various altitudes, the model demonstrated strong generalization, measured by MAE and mean absolute scaled error. Using the past 60 days of input data, the model predicted soil moisture 3 days ahead, supporting growers in irrigation planning. Although the error measurement values increased when using fewer input days, this result may be specific to the Serbia context.

In this study, the LSTM model was constructed using historical soil moisture and rainfall data estimate soil moisture. The predicted values closely followed the trend of the observed values. These findings contrast with those of Gao et al. [53], who reported that their deep-LSTM soil moisture prediction model, which used multiple meteorological variables including relative humidity, air temperature, rainfall, wind direction, and wind speed, showed the largest RMSE during heavy rainfall periods. A possible reason for this difference is that, unlike the study of Gao et al. [43], the present model used only two variables of rainfall and soil moisture. Since data-driven deep learning models rely greatly on input data [54], careful selection of relevant features can produce models that are faster and easier to train, more robust, and potentially more interpretable [55].

This study demonstrated a strategy for interpreting the soil moisture prediction performance of LSTM models, known for their precision and interpretability. It applied explainable agronomic artificial intelligence by proposing a novel method to enhance the interpretability and reliability of the LSTM models in predicting soil moisture. However, certain limitations remain. This study did not consider the impact of human activities on soil structure, which can be altered by farm machinery-induced soil compaction [56,57] or prolonged wet conditions from irrigation that promote soil hard setting and coalescence [58]. However, the LSTM model developed in this study was not designed to quantify such effects. In addition, although the model demonstrated an acceptable RMSE, future studies should incorporate longer-term data collection to enhance the robustness and reliability of the predictions [59]. Additionally, the performance of the models in soil moisture prediction was evaluated only at a single location. Although the model effectively predicted the topsoil moisture dynamics, future work should extend the predictions across soil profiles and examine spatial variability of soil moisture in the active root zone. Furthermore, microclimate differences, due to the 6.7 km distance between the experimental site and the automatic weather stations for collecting meteorological data, may have affected the prediction accuracy. Future studies should evaluate the generalizability and applicability of the approach using diverse datasets, locations, and input variables. Accurate long-term soil moisture prediction can help develop precision irrigation systems that deliver the right amount of water at the right time. Ultimately, such predictions enable better preparation for potential water shortages.

Conclusion

Soil moisture is the primary water source for fruit trees in orchards and is replenished mainly by rainfall. To use limited freshwater resources efficiently, it is crucial to analyze and predict how rainfall affects soil moisture. This study developed LSTM models to predict soil moisture in an Asian pear orchard. To improve prediction accuracy, hourly rainfall data were segmented into discrete events using the MIET. During the monitoring period, with the maximum hourly rainfall peaking at 48.5 mm on June 28, 2023, and reaching 27 mm on September 21, 2024. Rainfall-induced changes in moisture were most dynamic in the topsoil, while the subsoil retained added moisture for longer periods. The model showed that soil moisture forecasts at ‘t + 1’ had the lowest MAE and RMSE values across all time horizons. As the forecasting horizon extended to ‘t + 12’, the models still maintained robust performance; specifically, when utilizing hourly rainfall inputs, the MAE values were 1.22%, 2.47%, and 1.21%, while the RMSE values were 3.02%, 4.44%, and 2.37% at depths of 20, 40, and 60 cm, respectively. In comparison, the event-based rainfall inputs yielded slightly higher but acceptable errors at ‘t + 12’, with MAE values of 1.50%, 2.58%, and 1.24%, and RMSE values of 3.10%, 4.62%, and 2.44% across the corresponding depths. Utilizing LSTM models to forecast future soil moisture content in the surface zone, in conjunction with historical event-based rainfall and soil moisture data, can facilitate the accurate detection of changes in soil moisture in open fields more than hourly rainfall. and support the planning of effective irrigation schedules, particularly where freshwater resources are limited. Future research should focus on enhancing soil moisture prediction models by applying them to the entire soil profile.

Supporting information

S1 File. Compared a Support vector machine/Random forest-based soil moisture prediction model with an LSTM prediction model.

https://doi.org/10.1371/journal.pone.0353268.s001

(DOCX)

S1 Fig. Observed and predicted soil moisture contents at a depth of 20 cm in training period.

The prediction system was evaluated at four forecast time horizons: ‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) without MIET or event-based rainfall data with the minimum inter-event time (MIET) (b, d, f, h). Observed and predicted soil moisture contents are represented by solid and dotted lines, respectively.

https://doi.org/10.1371/journal.pone.0353268.s002

(TIF)

S2 Fig. Observed and predicted soil moisture contents at a depth of 40 cm in training period.

The prediction system was evaluated at four forecast time horizons: ‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) without MIET or event-based rainfall data with the minimum inter-event time (MIET) (b, d, f, h). Observed and predicted soil moisture contents are represented by solid and dotted lines, respectively.

https://doi.org/10.1371/journal.pone.0353268.s003

(TIF)

S3 Fig. Observed and predicted soil moisture contents at a depth of 60 cm in training period.

The prediction system was evaluated at four forecast time horizons: ‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) without MIET or event-based rainfall data with the minimum inter-event time (MIET) (b, d, f, h). Observed and predicted soil moisture contents are represented by solid and dotted lines, respectively.

https://doi.org/10.1371/journal.pone.0353268.s004

(TIF)

S1 Table. Performance comparison of LSTM models using hourly and event-based rainfall inputs in soil moisture prediction at various time horizons at different soil depths in train phase.

MAE, mean absolute error; RMSE, root mean square error; nRMSE, normalized RMSE. Hourly rainfall and event-based rainfall are either raw data collected in AWS at 1 h intervals, or data classified as different rainfall events by MIET, which classifies 12-hour periods of no rainfall between rainfall records as different events after cumulative sum processing. In time horizon, ‘t’ means present, and model forecasts four future time horizons.

https://doi.org/10.1371/journal.pone.0353268.s005

(XLSX)

S4 Fig. Scatter plots between observed and predicted soil moisture contents at a depth of 20 cm in test period.

‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) without MIET or event-based rainfall data with the minimum inter-event time (MIET) (b, d, f, h). Dashed diagonal line indicates a 1:1 relationship between measured and predicted soil moisture.

https://doi.org/10.1371/journal.pone.0353268.s006

(TIF)

S5 Fig. Scatter plots between observed and predicted soil moisture contents at a depth of 40 cm in test period.

‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) without MIET or event-based rainfall data with the minimum inter-event time (MIET) (b, d, f, h). Dashed diagonal line indicates a 1:1 relationship between measured and predicted soil moisture.

https://doi.org/10.1371/journal.pone.0353268.s007

(TIF)

S6 Fig. Scatter plots between observed and predicted soil moisture contents at a depth of 60 cm in test period.

‘t + 1’ (a, b), ‘t + 3’ (c, d), ‘t + 6’ (e, f), and ‘t + 12’ (g, h). Predictions were based on either hourly rainfall data (a, c, e, g) without MIET or event-based rainfall data with the minimum inter-event time (MIET) (b, d, f, h). Dashed diagonal line indicates a 1:1 relationship between measured and predicted soil moisture.

https://doi.org/10.1371/journal.pone.0353268.s008

(TIF)

References

  1. 1. Seneviratne SI, Corti T, Davin EL, Hirschi M, Jaeger EB, Lehner I, et al. Investigating soil moisture–climate interactions in a changing climate: A review. Earth Sci Rev. 2010;99(3–4):125–61.
  2. 2. Corradini C. Soil moisture in the development of hydrological processes and its determination at different spatial scales. J Hydrol. 2014;516:1–5.
  3. 3. Dukes MD, Zotarelli L, Morgan KT. Use of Irrigation Technologies for Vegetable Crops in Florida. hortte. 2010;20(1):133–42.
  4. 4. Mane S, Mane M, Kadam U. Performance evaluation of automatic irrigation system under three different depths of placement of sensor. Int J Curr Microbiol App Sci. 2021;10(07):170–81.
  5. 5. Lamaoui M, Jemo M, Datla R, Bekkaoui F. Heat and Drought Stresses in Crops and Approaches for Their Mitigation. Front Chem. 2018;6:26. pmid:29520357
  6. 6. Silva BM, Oliveira GC, Serafim ME, Silva ÉA, Guimarães PTG, Melo LBB, et al. Soil moisture associated with least limiting water range, leaf water potential, initial growth and yield of coffee as affected by soil management system. Soil and Tillage Research. 2019;189:36–43.
  7. 7. Zhang C, Liu J, Shang J, Cai H. Capability of crop water content for revealing variability of winter wheat grain yield and soil moisture under limited irrigation. Sci Total Environ. 2018;631–632:677–87. pmid:29539596
  8. 8. Yu J, Zhang X, Xu L, Dong J, Zhangzhong L. A hybrid CNN-GRU model for predicting soil moisture in maize root zone. Agric Water Manag. 2021;245:106649.
  9. 9. Kang SR, Cho CK, Na MH. Soil moisture change and prediction model development using weather and soil environment information for field vegetables. JKDAS. 2023;25(4):1311–24.
  10. 10. Hedley CB, Yule IJ. A method for spatial prediction of daily soil water status for precise irrigation scheduling. Agricultural Water Management. 2009;96(12):1737–45.
  11. 11. Singh G, Panda RK, Mohanty BP. Spatiotemporal Analysis of Soil Moisture and Optimal Sampling Design for Regional‐Scale Soil Moisture Estimation in a Tropical Watershed of India. Water Resources Research. 2019;55(3):2057–78.
  12. 12. Mane S, Das N, Singh G, Cosh M, Dong Y. Advancements in dielectric soil moisture sensor calibration: A comprehensive review of methods and techniques. Comput Electron Agric. 2024;218:108686.
  13. 13. He H, Turner NC, Aogu K, Dyck M, Feng H, Si B. Time and frequency domain reflectometry for the measurement of tree stem water content: A review, evaluation, and future perspectives. Agric For Meteorol. 2021;306:108442.
  14. 14. Zha X, Zhu W, Han Y, Lv A. Enhancing root-zone soil moisture estimation using Richards’ equation and dynamic surface soil moisture data. Agricultural Water Management. 2025;312:109460.
  15. 15. Li P, Zha Y, Shi L, Tso C-H, Zhang Y, Zeng W. Comparison of the use of a physical-based model with data assimilation and machine learning methods for simulating soil water dynamics. J Hydrol. 2020;584:124692.
  16. 16. Karthikeyan L, Mishra AK. Multi-layer high-resolution soil moisture estimation using machine learning over the United States. Remote Sensing of Environment. 2021;266:112706.
  17. 17. Carranza C, Nolet C, Pezij M, van der Ploeg M. Root zone soil moisture estimation with Random Forest. Journal of Hydrology. 2021;593:125840.
  18. 18. Murugesan R, Mishra E, Krishnan AH. Deep learning based models: Basic LSTM, Bi LSTM, Stacked LSTM, CNN LSTM and Conv LSTM to forecast agricultural commodities prices. 2021.
  19. 19. Zhang J, Zhu Y, Zhang X, Ye M, Yang J. Developing a long short-term memory (LSTM) based model for predicting water table depth in agricultural areas. J Hydrol. 2018;561:918–29.
  20. 20. Ma W, Peng L, Chen H, Yan H. Interval price prediction of livestock product based on fuzzy mathematics and improved LSTM. PLoS One. 2025;20(2):e0318823. pmid:39951436
  21. 21. Hochreiter S, Schmidhuber J. Long short-term memory. Neural Comput. 1997;9(8):1735–80. pmid:9377276
  22. 22. Datta P, Faroughi SA. A multihead LSTM technique for prognostic prediction of soil moisture. Geoderma. 2023;433:116452.
  23. 23. Park S-H, Lee B-Y, Kim M-J, Sang W, Seo MC, Baek J-K, et al. Development of a Soil Moisture Prediction Model Based on Recurrent Neural Network Long Short-Term Memory (RNN-LSTM) in Soybean Cultivation. Sensors (Basel). 2023;23(4):1976. pmid:36850574
  24. 24. Makridakis S, Spiliotis E, Assimakopoulos V. Statistical and Machine Learning forecasting methods: Concerns and ways forward. PLoS One. 2018;13(3):e0194889. pmid:29584784
  25. 25. Acharya U, Daigh AL, Oduor PG. Machine learning for predicting field soil moisture using soil, crop, and nearby weather station data in the Red River Valley of the North. Soil Syst. 2021;5(4):57.
  26. 26. Dolaptsis K, Pantazi XE, Paraskevas C, Arslan S, Tekin Y, Bantchina BB. A hybrid lstm approach for irrigation scheduling in maize crop. Agriculture. 2024;14(2):210.
  27. 27. Li Q, Zhu Y, Shangguan W, Wang X, Li L, Yu F. An attention-aware LSTM model for soil moisture and soil temperature prediction. Geoderma. 2022;409:115651.
  28. 28. Glaroudis D, Iossifides A, Chatzimisios P. Survey, comparison and research challenges of IoT application protocols for smart farming. Comput Networks. 2020;168:107037.
  29. 29. Zhang J, Duan L, Liu T, Chen Z, Wang Y, Li M, et al. Experimental analysis of soil moisture response to rainfall in a typical grassland hillslope under different vegetation treatments. Environ Res. 2022;213:113608. pmid:35688223
  30. 30. Teshome FT, Bayabil HK, Schaffer B, Ampatzidis Y, Hoogenboom G. Improving soil moisture prediction with deep learning and machine learning models. Comput Electron Agric. 2024;226:109414.
  31. 31. Haiyan DAI, Haimei WANG. Influence of rainfall events on soil moisture in a typical steppe of Xilingol. Physics and Chemistry of the Earth, Parts A/B/C. 2021;121:102964.
  32. 32. Lee J, Chung G. Estimation of InterEvent Time Definition Using in Urban Areas. J Korean Soc Hazard Mitig. 2017;17(4):287–94.
  33. 33. Abbes AB, Magagi R, Goita K. Soil moisture estimation from smap observations using long short-term memory (LSTM). In: 2019. https://doi.org/10.1109/IGARSS.2019.8898418
  34. 34. Siami-Namini S, Tavakoli N, Namin AS. The performance of LSTM and BiLSTM in forecasting time series. In: 2019. https://doi.org/10.1109/BigData47090.2019.9005997
  35. 35. Gers FA, Schmidhuber J, Cummins F. Learning to forget: continual prediction with LSTM. Neural Comput. 2000;12(10):2451–71. pmid:11032042
  36. 36. Hu J, Zheng W. Transformation-gated LSTM: efficient capture of short-term mutation dependencies for multivariate time series prediction tasks. In: 2019. https://doi.org/10.1109/IJCNN.2019.8852073
  37. 37. Yang L, Shami A. On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing. 2020;415:295–316.
  38. 38. Injadat M, Moubayed A, Nassif AB, Shami A. Systematic ensemble model selection approach for educational data mining. Knowl Based Syst. 2020;200:105992.
  39. 39. Hodson TO. Root mean square error (RMSE) or mean absolute error (MAE): When to use them or not. Geosci Model Dev. 2022;2022:1–10.
  40. 40. Jabro J, Evans R, Kim Y, Iversen W. Estimating in situ soil–water retention and field water capacity in two contrasting soil textures. Irrig Sci. 2009;27(3):223–9.
  41. 41. He Z, Jia G, Liu Z, Zhang Z, Yu X, Xiao P. Field studies on the influence of rainfall intensity, vegetation cover and slope length on soil moisture infiltration on typical watersheds of the Loess Plateau, China. Hydrol Process. 2020;34(25):4904–19.
  42. 42. Chen J, Cheng D, Li Z, Jiao L. Soil Water Dynamic and its Response to Rainfalls in an Apple Orchard of the Loess Plateau, China: Implication for Irrigation Management. Air, Soil and Water Research. 2024;17.
  43. 43. Gao Y, Miyata S, Akashi Y. Multi-step solar irradiation prediction based on weather forecast and generative deep learning model. Renewable Energy. 2022;188:637–50.
  44. 44. Muzaffar S, Afshari A. Short-Term Load Forecasts Using LSTM Networks. Energy Procedia. 2019;158:2922–7.
  45. 45. Sarjerao JS, Sudhagar G. Integration of Remote Sensing and IoT for Real-Time Monitoring of Irrigation in Smart Farming. In: 2024 1st International Conference on Innovative Sustainable Technologies for Energy, Mechatronics, and Smart Systems (ISTEMS). 2024. 1–6.
  46. 46. Matei O, Rusu T, Petrovan A, Mihuţ G. A Data Mining System for Real Time Soil Moisture Prediction. Procedia Engineering. 2017;181:837–44.
  47. 47. Beyer K, Goldstein J, Ramakrishnan R, Shaft U. In: 1999.
  48. 48. Smola AJ, Schölkopf B. A tutorial on support vector regression. Stat Comput. 2004;14(3):199–222.
  49. 49. Pal SK, Mitra S. Multilayer perceptron, fuzzy sets, and classification. IEEE Trans Neural Netw. 1992;3(5):683–97. pmid:18276468
  50. 50. Keerthi SS, Duan K, Shevade SK, Poo AN. A fast dual algorithm for kernel logistic regression. Mach Learn. 2005;61(1):151–65.
  51. 51. Fan RE, Chang KW, Hsieh CJ, Wang XR, Lin CJ. LIBLINEAR: A library for large linear classification. J Mach Learn Res. 2008;9:1871–4.
  52. 52. Filipović N, Brdar S, Mimić G, Marko O, Crnojević V. Regional soil moisture prediction system based on Long Short-Term Memory network. Biosyst Eng. 2022;213:30–8.
  53. 53. Gao P, Qiu H, Lan Y, Wang W, Chen W, Han X, et al. Modeling for the Prediction of Soil Moisture in Litchi Orchard with Deep Long Short-Term Memory. Agriculture. 2021;12(1):25.
  54. 54. Thomopoulos R, Destercke S, Charnomordic B, Johnson I, Abécassis J. An iterative approach to build relevant ontology-aware data-driven models. Inf Sci. 2013;221:452–72.
  55. 55. Dubois A, Teytaud F, Verel S. Short term soil moisture forecasts for potato crop farming: A machine learning approach. Computers and Electronics in Agriculture. 2021;180:105902.
  56. 56. Chan K, Oates A, Swan A, Hayes R, Dear B, Peoples M. Agronomic consequences of tractor wheel compaction on a clay soil. Soil Tillage Research. 2006;89(1):13–21.
  57. 57. Keller T, Sandin M, Colombi T, Horn R, Or D. Historical increase in agricultural machinery weights enhanced soil stress levels and adversely affected soil functioning. Soil Tillage Research. 2019;194:104293.
  58. 58. Murray R, Grant C. The impact of irrigation on soil structure. Land and Water Australia. 2007;:1–31.
  59. 59. Sirisha UM, Belavagi MC, Attigeri G. Profit Prediction Using ARIMA, SARIMA and LSTM Models in Time Series Forecasting: A Comparison. IEEE Access. 2022;10:124715–27.