Prediction of Daily Ambient Temperature and Its Hourly Estimation Using Artificial Neural Networks in an Agrometeorological Station in Castile and León, Spain

This study evaluates the predictive modeling of the daily ambient temperature (maximum, Tmax; average, Tave; and minimum, Tmin) and its hourly estimation (T0h, …, T23h) using artificial neural networks (ANNs) for agricultural applications. The data, 2004–2010, were used for training and 2011 for validation, recorded at the SIAR agrometeorological station of Mansilla Mayor (León). ANN models for daily prediction have three neurons in the output layer (Tmax(t + 1), Tave(t + 1), Tmin(t + 1)). Two models were evaluated: (1) with three entries (Tmax(t), Tave(t), Tmin(t)), and (2) adding the day of the year (J(t)). The inclusion of J(t) improves the predictions, with an RMSE for Tmax = 2.56, Tave = 1.65 and Tmin = 2.09 (°C), achieving better results than the classical statistical methods (typical year Tave = 3.64 °C; weighted moving mean Tmax = 2.76, Tave = 1.81 and Tmin = 2.52 (°C); linear regression Tave = 1.85 °C; and Fourier Tmax = 3.75, Tave = 2.67 and Tmin = 3.34 (°C)) for one year. The ANN models for hourly estimation have 24 neurons in the output layer (T0h(t), …, T23h(t)) corresponding to the mean hourly temperature. In this case, the inclusion of the day of the year (J(t)) does not significantly improve the estimations, with an RMSE = 1.25 °C, but it improves the results of the ASHRAE method, which obtains an RMSE = 2.36 °C for one week. The results obtained, with lower prediction errors than those achieved with the classical methods, confirm the interest in using the ANN models for predicting temperatures in agricultural applications.


Introduction
Climate is an important factor in agricultural production, since meteorological variables are decisive in promoting plant growth and causing multiple physiological phenomena. Thus, accurate data are necessary for studying the growth and development of crops [1]. Specifically, ambient temperature is one of the key variables for crop prediction, especially in precision agriculture [2].
Early crop yield forecasts provide valuable information for growers and the industry. Thanks to the effectiveness of these forecasts, you can base your raw material transformation decisions [3]. Furthermore, the use of global climate models provides considerable information for the simulation of agricultural impacts [4].
Current crop models develop the growth process with daily temporal resolution (although some crop models require hourly diurnal temperature patterns) and use meteorological variables as inputs. On the other hand, there is the spatial resolution of the In this study, we study the daily ambient temperature (maximum, average, and minimum) for the next day-i.e., (T max (t + 1), T ave (t + 1), and T min (t + 1))-and its estimation of the hourly mean distribution-i.e., (T 0h (t), . . . , T 23h (t))-through ANN-based models and using data measured from Mansilla Mayor, León, Castile and León, Spain. The main objective of this work was to achieve better daily and hourly predictions of ambient temperature for agricultural purposes to obtain a better prediction of (T(t + 1)) and estimation of (T 0h (t), . . . , T 23h (t)), using the least possible number of inputs. This is the main novelty of the study, to facilitate the practical application of this type of prediction model in the evaluation of irrigation needs and other agricultural processes ( [17][18][19]), so as to predict plant growth or disease control [20]. For this, different ANNs were built with temperature data (maximum, average, and minimum), resulting in a better simulation fit than that achieved with the classic models, which were slightly optimized by adding the day of the year (J(t)) as a predictor, which considers the trend at the time of year.

Materials and Methods
This section describes: (1) the ambient temperature data used with the experimented models, the agrometeorological station in which they were recorded, and the place where it is located; (2) the ANN models designed for the prediction of the daily and hourly ambient temperature; and (3) the classical models (i.e., CENSOLAR typical year, weighted moving mean (WMM) with partial autocorrelation, linear regression, Fourier analysis, and ASHRAE method for hourly ambient temperature) used for their comparison.

Ambient Temperature Data
The ambient temperature data used in this study, during a period of eight years (i.e., [2004][2005][2006][2007][2008][2009][2010][2011], were collected at the agrometeorological station belonging to the Agroclimatic Information System for Irrigation (SIAR), located in Mansilla Mayor (León, Castile, and León, north-central Spain), with geographic coordinates 42 • 30 43 N and 5 • 26 46 W, altitude 791 m.a.s.l. and local time GMT-21.725555. SIAR is a project of the Ministry of Environment and Rural Areas and Maritime of Spain, which is managed by the Agricultural Technological Institute in Castile and León (ITACyL), through the meteorological information service InfoRiego [21], through which farmers obtain advice on irrigation water to rationalize it.
The ambient temperature in the reference agrometeorological station was measured with a Pt-1000 temperature sensor, which is based on the variation of platinum resistance with temperature. The electronic circuit for the linearization and amplification of this sensor is located next to the Vaisala HMP45C probe (Campbell Scientific, Inc., North Logan, UT, USA) to measure the ambient temperature and relative humidity, in the ranges of −40 at 60 • C, and 0 to 100%, respectively. The climatic classification of the location of the agrometeorological station is Csb [22], according to the Köppen-Geiger climatic classification, with the following annual average values (data from 1981-2010):

Prediction of Ambient Temperature Using Artificial Neural Networks
The prediction of the ambient temperature (maximum, average, and minimum) of the next day ((T max (t + 1), T ave (t + 1), T min (t + 1)), • C), was carried out with two empirical models of the black-box type, implemented with artificial neural networks (ANNs) that use data corresponding to the seven years from 2004 to 2010. The automatic pre-processing and post-processing of the data was carried out with the Graphical User Interface (GUI) Neural Network Fitting Toolbox (nftool) MATLAB [23].
To achieve the proposed objective, two models with ANN architecture (i.e., ANN-1d and ANN-2d) were designed, with different combinations of input data: • (T max (t)), the maximum daily temperature of the current day, • C; • (T ave (t)), the average daily temperature of the current day, • C; • (T min (t)), the daily minimum temperature of the current day, • C; • (J(t)), number of the day of the year (1, . . . , 365), dimensionless.
In the hidden layer of the two ANN models evaluated, different numbers of neurons were used (i.e., 1-10, 20, 30, 40, and 50) to determine their influence on the precision of the simulation. The output layer in the two ANN models tested had three neurons corresponding to the predictions (T max (t + 1), T ave (t + 1), T min (t + 1)) for a whole year (2011), calculating the root mean square error (RMSE, • C), which was obtained in these predictions for the measured data, to select an ANN model with the best predictive behavior. The ANN architectures evaluated are shown in Figure 1a,b.

Prediction of Ambient Temperature Using Artificial Neural Networks
The prediction of the ambient temperature (maximum, average, and minimum) of the next day ((Tmax(t + 1), Tave(t + 1), Tmin(t + 1)), °C), was carried out with two empirical models of the black-box type, implemented with artificial neural networks (ANNs) that use data corresponding to the seven years from 2004 to 2010. The automatic pre-processing and post-processing of the data was carried out with the Graphical User Interface (GUI) Neural Network Fitting Toolbox (nftool) MATLAB [23].
To achieve the proposed objective, two models with ANN architecture (i.e., ANN-1d and ANN-2d) were designed, with different combinations of input data: • (Tmax(t)), the maximum daily temperature of the current day, °C; • (Tave(t)), the average daily temperature of the current day, °C; • (Tmin(t)), the daily minimum temperature of the current day, °C; • (J(t)), number of the day of the year (1,..., 365), dimensionless.
In the hidden layer of the two ANN models evaluated, different numbers of neurons were used (i.e., 1-10, 20, 30, 40, and 50) to determine their influence on the precision of the simulation. The output layer in the two ANN models tested had three neurons corresponding to the predictions (Tmax(t + 1), Tave(t + 1), Tmin(t + 1)) for a whole year (2011), calculating the root mean square error (RMSE, °C), which was obtained in these predictions for the measured data, to select an ANN model with the best predictive behavior. The ANN architectures evaluated are shown in Figure 1a,b. Figure 1. Architecture of the models with artificial neural networks (ANNs) evaluated for daily temperature, based on the input variables: (a) ANN-1d model, with three inputs (Tmax(t), Tave(t), Tmin(t)); (b) ANN-2d model, with four inputs (Tmax(t), Tave(t), Tmin(t), J(t)); and for hourly temperature, based on the input variables: (c) ANN-1h model, with three inputs (Tmax(t), Tave(t), Tmin(t)); (d) ANN-2h model, with four inputs (Tmax(t), Tave(t), Tmin(t), J(t)).
The estimation of the hourly ambient temperature during the 24 h of the same day ((T0h(t), T1h(t),…, T23h(t)), °C), was carried out with two empirical models of the black-box type, implemented with ANNs that use data corresponding to the seven years 2004-2010. The ANN architectures evaluated are shown in Figure 1c,d. To achieve the proposed objective, two models with ANN architecture (i.e., ANN-1h and ANN-2h) were designed, Figure 1. Architecture of the models with artificial neural networks (ANNs) evaluated for daily temperature, based on the input variables: (a) ANN-1d model, with three inputs (T max (t), T ave (t), T min (t)); (b) ANN-2d model, with four inputs (T max (t), T ave (t), T min (t), J(t)); and for hourly temperature, based on the input variables: (c) ANN-1h model, with three inputs (T max (t), T ave (t), T min (t)); (d) ANN-2h model, with four inputs (T max (t), T ave (t), T min (t), J(t)).
The estimation of the hourly ambient temperature during the 24 h of the same day ((T 0h (t), T 1h (t), . . . , T 23h (t)), • C), was carried out with two empirical models of the black-box type, implemented with ANNs that use data corresponding to the seven years 2004-2010. The ANN architectures evaluated are shown in Figure 1c,d. To achieve the proposed objective, two models with ANN architecture (i.e., ANN-1h and ANN-2h) were designed, with the same combination of input data used previously in the prediction of daily temperature values.
In the hidden layer of the two ANN models evaluated, two numbers of neurons were used (i.e., 28 and 26) for the ANN-1h and ANN-2h models, respectively. The output layer in the two ANN models tested had 24 neurons corresponding to the estimates of the hourly mean ambient temperature (T 0h (t), T 1h (t), . . . , T 23h (t)) for a whole week (Week: 10, . . . ,  16 May 2011), calculating the root mean square error (RMSE, • C), which was obtained in these estimates for the measured data, to select an ANN model with better predictive behavior.
The ANNs are created with the feedforwardnet function, dimensioned with the input and output data vectors, which determine the size of the respective layers, generating a perceptron multilayer feedforward (MLP) ANN with a single hidden layer, where the function of activation selected for neurons in the hidden layer is the hyperbolic sigmoid tangent (tansig), while the selected transfer function for neurons in the output layer is linear (purelin) [24][25][26].
The Levenberg-Marquardt (BP-LM) back-propagation algorithm is applied to achieve rapid optimization (trainlm), as well as the following options: bias learning function and weighting moment with descending gradient (learngdm); normalized squared error function (mse); and input matrix element processing functions, such as data processing to recode unknown data rows (fixunknowns), repeated data vectors in the input, which do not provide useful information (removeconstantrows), and matrix processing to normalized vectors with minimum and maximum values in the range of −1 to 1 (mapminmax) [24][25][26].
ANN training was performed with the train function, with input and output data vector matrices over a period of seven years. (i.e., from 2004 to 2010, without considering 2011, as it is the year of verification), registering the entire training period (epoch and performance function). Finally, the sim function was used, with the ANNs previously trained, to make the prediction of (T max (t + 1), T ave (t + 1), T min (t + 1)), with the vector matrix of input data from 2011, and to make the estimation of (T 0h (t), T 1h (t), . . . , T 23h (t)), with the vector matrix of input data from 10, . . . , 16 May 2011.

Prediction of Ambient Temperature Using Classic Models
The classical statistical models for predicting ambient air temperature, which has been considered in this work, are: (1) CENSOLAR typical year; (2) weighted moving average with partial autocorrelation; (3) linear regression; (4) Fourier analysis; and (5) the ASHRAE method for hourly ambient temperature. The construction of the models was carried out by taking the ambient temperature in the air corresponding to the seven years (2004-2010) that were considered for the construction of the models.

CENSOLAR Typical Year
The daytime ambient temperature values, included in the CENSOLAR tables [27], characterize an average day of each month in a typical year. This is why this model is mainly applicable to large geographic areas and for long periods. The information is available for each of the Spanish provinces.

Weighted Moving Mean (WMM) with Partial Autocorrelation
Partial autocorrelation refers to the dependence of the value of the variable with the same values of the preceding variable in time. For this reason, the weighted moving mean (WMM) model with partial autocorrelation is applied, giving more weight to the values closest to the simulation day and less weight to the furthest ones, with the aim that the average value behaves more agilely than when using a simple moving mean model.
In the present work, partial autocorrelation coefficients obtained over seven years were used, which were calculated with the MATLAB parcorr function, defining the weighted moving mean with time lags from 2 to 20 days, in 2011. The coefficients of partial autocorrelation are applied to the value of room temperature corresponding to its delay day, making the sum of these products and dividing by the sum of those coefficients.

Linear Regression
The prediction of the ambient temperature can be carried out employing a linear regression, which models the relationship between a dependent variable-in this case, the ambient temperature (maximum, average, and minimum) the next day (T max (t + 1), T ave (t + 1), and T min (t + 1)), and an independent variable, in this case, the ambient tempera- ture (maximum, average, and minimum) of the current day (T max (t), T ave (t), and T min (t)), along with a random term calculated using the MATLAB Curve Fitting Toolbox (cftool).

Fourier Analysis
Fourier analysis is applied to variables that present significant frequencies [9,28], as occurs with room temperature (maximum, average, and minimum). In this case, the MATLAB Curve Fitting Toolbox (cftool) was used to calculate the coefficients from the 1st to the 8th harmonic.

ASHRAE Method for Hourly Ambient Temperature
The cycle of daily solar irradiation conditions that the minimum ambient temperature usually occurs shortly before dawn, and that the maximum ambient temperature occurs between one and four hours after solar noon. Then, the daily hourly ambient temperature curve is divided into two periods: a warming period in the morning and a cooling period in the afternoon. The ASHRAE method provides a value for the ambient air temperature during each hour of the day, i.e., T ASHRAE = T max − (f hour (T max − T min )), as a function of the daily maximum and minimum ambient temperature, and a factor for every hour of the day in Table 1 [29].

Results and Discussion
This section includes the results obtained by the models in the prediction of the daily ambient temperature (maximum, average, and minimum) of the next day (t + 1), and the estimation of the hourly ambient temperature of the same day (t). For this purpose, measurements taken by the agrometeorological station of the SIAR network, located in Mansilla Mayor (León, Castile and León, Spain), were used. During the years 2004-2010, the data were applied for the training of the ANN models and the execution of the classic models, using the data measured during the year 2011 from the same station for the validation of the models. A comparison of the results obtained by the two types of models was made using the statistics: root mean square error (RMSE, • C), using Equation (1); coefficient of determination (R 2 ), as an indicator of the level of fit of the model, utilizing Equation (2); the Durbin-Watson coefficient (DW), used to detect first-order self-correction between the data, using Equation (3); the mean percentage error (MPE), which allows the interpretation of the bias in the prediction error, employing Equation (4); forecast accuracy (FA), which is used in short-term forecasting models, using Equation (5); and the Akaike information criterion (AIC), used to select the most appropriate model taking into account the number of variables used, penalizing the more complex models, using Equation (6).

Results of Predictions with Artificial Neural Network Models (ANNs)
First, the research focused on ANN models to identify the network architecture that most accurately simulates (T max (t + 1), T ave (t + 1), T min (t + 1)), as a function of the number of neurons (i.e., 1-10, 20, 30, 40, and 50) that make up the hidden layer. The statistic used for the validation is the RMSE of the simulated output concerning the data measured for the same variable. The results obtained for the ANN-1d model are shown in Figure 2. The best results of the prediction developed for the output variable (T max (t + 1)) were achieved with the architectures (3-4-3) and (3-8-3), with RMSE = 2.75 • C, while for the output variable (T ave (t + 1)), the best results were obtained with the architecture (3-5-3), with RMSE = 1.75 • C. Finally, the best behavior for the output variable (T min (t + 1)) was obtained with the architecture (3-5-3), with an RMSE = 2.11 • C. Table 2 shows the other statistics analyzed for the architecture (3-8-3). It is observed that the prediction error is much lower for the daily mean temperature than for the daily minimum temperature, and for the daily maximum temperature, the worst result is achieved.
In addition, from the results obtained with the simulation using the ANN-2d model ( Figure 2), it can be seen that the best results of the prediction developed for the output variable (T max (t + 1)) were with the architecture (4-5-3), RMSE = 2.56 • C, while for the output variable (T ave (t + 1)), the best results were obtained with the architectures (4-3-3), (4-5-3), and (4-10-3), with RMSE = 1.65 • C. Finally, the best behavior for the output variable (T min (t + 1)) was obtained with the architecture (4-3-3), with an RMSE = 2.09 • C. Table 2 shows the other statistics analyzed for the architecture (4-8-3). It is observed that the prediction error is slightly lower when the entry of the day of the year (J(t)) is added for the three temperatures, which may have to do with the greater persistence of the daily temperature (e.g., daily solar irradiation [26]).  The best results of the variables (Tmax(t + 1), Tave(t + 1), Tmin(t + 1)) with each statistic (RMSE (°C), R 2 , DW, MPE, FA and AIC) are underlined.
(a) (b) The estimation of the hourly mean ambient air temperature of the same day (T0h(t), T1h(t),…, T23h(t)), which was carried out using the ANN-1h model, from the input variables: daily maximum, average, and minimum temperature of the same day (Tmax(t), Tave(t), Tmin(t)), with 28 neurons in the hidden layer of the artificial neural network. As a result, in the output simulation shown in Figure 3, together with the data measured during week 10,…, 16 May 2011, it obtains an RMSE = 1.25 °C and other statistics analyzed in Table 3.
In addition, the result obtained with the simulation using the ANN-2h model is shown in Figure 3: from the input variables daily maximum, average, and minimum temperature of the same day and the day of the year (Tmax(t), Tave(t), Tmin(t), J(t)), with 26 neurons in the hidden layer of the artificial neural network, it obtained an RMSE = 1.42 °C  The best results of the variables (T max (t + 1), T ave (t + 1), T min (t + 1)) with each statistic (RMSE ( • C), R 2 , DW, MPE, FA and AIC) are underlined.
The estimation of the hourly mean ambient air temperature of the same day (T 0h (t), T 1h (t), . . . , T 23h (t)), which was carried out using the ANN-1h model, from the input variables: daily maximum, average, and minimum temperature of the same day (T max (t), T ave (t), T min (t)), with 28 neurons in the hidden layer of the artificial neural network. As a result, in the output simulation shown in Figure 3, together with the data measured during week 10, . . . , 16 May 2011, it obtains an RMSE = 1.25 • C and other statistics analyzed in Table 3. The ANN-2h model, for the case of the inclusion of the day of the year (J(t)), does not provide significant improvement in the effectiveness of the estimation of the hourly distribution, as it depends on the particular climatic conditions of the specific day and not the trend at the time of year, which is what this variable contributes.

Results of the Classic Models
The behavior of the prediction models based on RNAs was compared with the behavior of the models that use classical techniques for predicting ambient temperature. The classic prediction models that were analyzed are CENSOLAR typical year, weighted moving mean, linear regression, Fourier analysis, and the ASHRAE method for hourly ambient temperature. In all cases, the basis of the analysis was the same, corresponding to the ambient temperature of the next day during 2011 and its comparison with the same variables measured by the agrometeorological station located in Mansilla Mayor (León, Spain), which belongs to SIAR. The figures show the results of the predictions for each day of the year. The tables summarize the analysis of fit between simulated and measured values. In the following subsubsections, the results obtained with each of the classic simulation models are analyzed.

CENSOLAR Typical Year
The values of the daily average ambient temperature during the daytime hours of a typical year in the province of León (Spain), which are found in the CENSOLAR tables Temperature, ºC Figure 3. Effectiveness of the estimation of hourly ambient temperature on the same day (hour 0, T 0h ; hour 1, T 1h ; . . . ; hour 23, T 23h ) simulated with the ANN model, compared to the measured values of the variable, at 10, . . . , 16 May 2011: (a) ANN-1h model, with three inputs (T max (t), T ave (t), T min (t)); (b) ANN-2h model, with four inputs (T max (t), T ave (t), T min (t), J(t)). RMSE: root mean square error ( • C). The best results of the variables (T 0h (t), . . . , T 23h (t)) with each statistic (RMSE ( • C), R 2 , DW, MPE, FA and AIC) are underlined.
In addition, the result obtained with the simulation using the ANN-2h model is shown in Figure 3: from the input variables daily maximum, average, and minimum temperature of the same day and the day of the year (T max (t), T ave (t), T min (t), J(t)), with 26 neurons in the hidden layer of the artificial neural network, it obtained an RMSE = 1.42 • C and other statistics analyzed in Table 3. The ANN-2h model, for the case of the inclusion of the day of the year (J(t)), does not provide significant improvement in the effectiveness of the estimation of the hourly distribution, as it depends on the particular climatic conditions of the specific day and not the trend at the time of year, which is what this variable contributes.

Results of the Classic Models
The behavior of the prediction models based on RNAs was compared with the behavior of the models that use classical techniques for predicting ambient temperature. The classic prediction models that were analyzed are CENSOLAR typical year, weighted moving mean, linear regression, Fourier analysis, and the ASHRAE method for hourly ambient temperature. In all cases, the basis of the analysis was the same, corresponding to the ambient temperature of the next day during 2011 and its comparison with the same variables measured by the agrometeorological station located in Mansilla Mayor (León, Spain), which belongs to SIAR. The figures show the results of the predictions for each day of the year. The tables summarize the analysis of fit between simulated and measured values. In the following subsubsections, the results obtained with each of the classic simulation models are analyzed.

CENSOLAR Typical Year
The values of the daily average ambient temperature during the daytime hours of a typical year in the province of León (Spain), which are found in the CENSOLAR tables [27], are represented together with the data of the average daily temperature of the SIAR database in Mansilla Mayor (León) during 2011 in Figure 4, obtaining an RMSE = 3.64 • C and other statistics analyzed in Table 4.  The CENSOLAR typical year can be used for a first approximation because it is quick and easy to apply. The model does not take into account the daily variations for each day of the month (i.e., it offers the same data for all days of the same month), and its spatial resolution is provincial (i.e., it offers the same data for all places in the same province).

Weighted Moving Mean (WMM) with Partial Autocorrelation
The partial autocorrelation coefficients that resulted when using the SIAR data in Mansilla Mayor (León) of the daily ambient temperature (maximum, average, and minimum) studied during seven years (2004)(2005)(2006)(2007)(2008)(2009)(2010), between 1 and 20 days, are shown in Table  5. It can be observed that the dependence of the ambient temperature-(Tmax(t + 1),Tave(t + 1)) and (Tmin(t + 1))-on a particular day is maximum (coefficients of partial autocorrelation, 0.9326, 0.9579 and 0.8961, with the previous day, (Tmax(t),Tave(t)) and (Tmin(t)), respectively), decreasing the dependence very quickly with the ambient temperature received the previous days: 0.0817, −0.0863, and 0.0331 for two days (T(t −    The CENSOLAR typical year can be used for a first approximation because it is quick and easy to apply. The model does not take into account the daily variations for each day of the month (i.e., it offers the same data for all days of the same month), and its spatial resolution is provincial (i.e., it offers the same data for all places in the same province).
Subsequently, for the prediction (T(t + 1)) during 2011, the WMM model was used with the partial autocorrelation coefficients that corresponded to the period between 2 and 20 days of delay, obtaining the simulation errors shown in Figure 5. The best results for the prediction made for the output variable (T max (t + 1)) were achieved with a delay of 6 days, with RMSE = 2.75 • C, while for the output variable (T ave (t + 1)), the best results were obtained with a delay of 5 days, with RMSE = 1.81 • C. Finally, the best result for the output variable (T min (t + 1)) was obtained with a delay of 10 days, with RMSE = 2.50 • C.
with the partial autocorrelation coefficients that corresponded to the period between 2 and 20 days of delay, obtaining the simulation errors shown in Figure 5. The best results for the prediction made for the output variable (Tmax(t + 1)) were achieved with a delay of 6 days, with RMSE = 2.75 °C, while for the output variable (Tave(t + 1)), the best results were obtained with a delay of 5 days, with RMSE = 1.81 °C. Finally, the best result for the output variable (Tmin(t + 1)) was obtained with a delay of 10 days, with RMSE = 2.50 °C. The model of the weighted moving mean with 2 days of delay for the daily ambient temperature (maximum, average, and minimum) is shown in Equations (7)-(9), respectively.
T (t + 1) = 0.9326 T (t) + 0.0817 T (t − 1) 0.9326 + 0.0817 The simulation carried out for the year 2011 is represented with the WMM equation obtained in Equations (7)-(9), together with the SIAR data, which obtain an RMSE = 2.86, 1.86, and 2.52 °C, respectively, in Figure 6, and other statistics analyzed in Table 6. The model of the weighted moving mean with 2 days of delay for the daily ambient temperature (maximum, average, and minimum) is shown in Equations (7)-(9), respectively.
T min (t + 1) = 0.8961 T min (t) + 0.0331 T min (t − 1) 0.8961 + 0.0331 The simulation carried out for the year 2011 is represented with the WMM equation obtained in Equations (7)-(9), together with the SIAR data, which obtain an RMSE = 2.86, 1.86, and 2.52 • C, respectively, in Figure 6, and other statistics analyzed in Table 6. Table 6. Effectiveness of the prediction of the weighted moving mean (WMM) using the partial autocorrelation coefficients for 2 and 5 days of temperature lag (maximum, average, and minimum), with respect to the SIAR data in Mansilla Mayor (León) for the year 2011. The best results of the variables (T max (t + 1), T ave (t + 1), T min (t + 1)) with each statistic (RMSE ( • C), R 2 , DW, MPE, FA and AIC) are underlined. The best results of the variables (Tmax(t + 1), Tave(t + 1), Tmin(t + 1)) with each statistic (RMSE (°C), R 2 , DW, MPE, FA and AIC) are underlined. The model of the weighted moving mean with 5 days of delay for the daily ambient temperature (maximum, average and minimum) is shown in Equations (10)- (12), respectively, which obtains an RMSE = 2.76, 1.81, and 2.53 °C and other statistics analyzed in Table 6. The model of the weighted moving mean with 5 days of delay for the daily ambient temperature (maximum, average and minimum) is shown in Equations (10)- (12), respectively, which obtains an RMSE = 2.76, 1.81, and 2.53 • C and other statistics analyzed in Table 6.

Linear Regression
The prediction of the average daily temperature for tomorrow was carried out with linear regression or linear adjustment, which is a mathematical method that models the relationship between a dependent variable, in this case, the value of the average daily temperature for tomorrow (T ave (t + 1)), the independent variables, in this case, the value of today's average daily temperature (T ave (t)), and a random term. This model can be expressed as Equation (13).
T ave (t + 1) = 0.9576 T ave (t) + 0.4357 (13) obtained from the data of the average daily temperature for the years 2004-2010 SIAR in Mansilla Mayor (León), with an RMSE = 1.96 • C, which is shown in Figure 7. The simulation carried out for the year 2011 is represented with the linear regression equation obtained (Equation (13)) together with the SIAR data, resulting in an RMSE = 1.85 °C, in Figure 8, and other statistics analyzed in Table 7.  The simulation carried out for the year 2011 is represented with the linear regression equation obtained (Equation (13)) together with the SIAR data, resulting in an RMSE = 1.85 • C, in Figure 8, and other statistics analyzed in Table 7.  The linear regression obtains a precision similar to the WMM in the prediction of the average daily temperature, when also using the daily persistence of the ambient temperature.

Fourier Analysis
The prediction of the daily ambient temperature (maximum, average, and minimum) was carried out with the calculation of the coefficients of the Fourier analysis for the data  The linear regression obtains a precision similar to the WMM in the prediction of the average daily temperature, when also using the daily persistence of the ambient temperature.

Fourier Analysis
The prediction of the daily ambient temperature (maximum, average, and minimum) was carried out with the calculation of the coefficients of the Fourier analysis for the data from 2004 to 2010 SIAR in Mansilla Mayor (León), obtaining the typical annual functions of Fourier shown in Tables 8-10, from the 1st to the 8th harmonic.
The simulation carried out with typical annual Fourier functions obtained for the 1st harmonic is represented, together with the SIAR data for the year 2011, which obtained an RMSE = 3.84, 2.67, and 3.37 • C, in Figure 9, and other statistics analyzed in Tables 11-13 for the daily ambient temperature (maximum, average, and minimum) of harmonics 1st-8th.
Fourier analysis can be used for a first approximation. The precision of the typical annual Fourier functions is less than the WMM, as it does not take into account daily temperature variations, while the latter does.

ASHRAE Method for Hourly Ambient Temperature
The prediction of the hourly ambient temperature was generated with the ASHRAE method, representing the estimate made together with the SIAR data for week 10, . . . , 16 May 2011, which obtained an RMSE = 2.36 • C, in Figure 10, and other statistics analyzed in Table 14. This hourly distribution of temperature that rises during the morning until a few hours after solar noon, and continues descending until dawn, is typical on clear days, when the variability of the atmospheric components is not very pronounced [30]. When cloudiness appears, the intensity of solar radiation, received by the surface of the ground, decreases, then the effect of a more constant temperature is usually produced throughout those hours, and when there are sudden storms or rains, the temperature drops more suddenly.

Conclusions
ANNs can learn, as the process varies over time, which makes them interesting for the creation of models applied in the prediction of the daily ambient temperature (Tmax(t + 1), Tave(t + 1), Tmin(t + 1)) and the estimation of its hourly distribution (T0h(t),…, T23h(t)).
In this study, ANN inputs are established as the (Tmax(t), Tave(t), Tmin(t)) of the day on which we make the prediction and adding the (J(t)), the ANN output being the future value of the next day, predicted (Tmax(t + 1), Tave(t + 1), Tmin(t + 1)) for the daily case, and its distribution on the same day estimated (T0h(t),…, T23h(t)) for the hourly case.
The prediction of the ambient temperature of the next day (T(t + 1)) is of great interest  This hourly distribution of temperature that rises during the morning until a few hours after solar noon, and continues descending until dawn, is typical on clear days, when the variability of the atmospheric components is not very pronounced [30]. When cloudiness appears, the intensity of solar radiation, received by the surface of the ground, decreases,