# An Adaptive Moving Window Kriging Based on K-Means Clustering for Spatial Interpolation
## Case Study: Spatial Interpolation of Meteorological Data in Thailand
### Results  
The simulations were conducted using MATLAB software (version 2018a) to assess the performances of all four algorithms. Prior to the MWKK and AMWKK implementations, a predetermined of a suitable \(k\) clustering number in the K-means algorithm is required. Here, we computed the Calinski-Harabasz index to indicate the optimal \(k\) number of clusters. With the lowest number of neighboring positions suggested by [PERSON] and [PERSON] (2003) being 30 positions, the possible number \(k\) of K-means clusters for both MWKK and AMWKK approaches was thereby in the range of 2 to 6 for pressure and 2 to 5 for humidity. According to Figure 3a,b, the value of Calinski-Harabasz index increased as the number of clusters increased. The optimal numbers of clusters corresponding to the maximum Calinski-Harabasz index were 6 and 5 for pressure and humidity, respectively. Table 1 displays the pressure estimation efficiency of all of the models. Regarding diagnostic statistics, all moving window kriging variants had superior estimation performances compared with the benchmark OK model. In particular, the mean MAPE and PAEE values of the OK model were above 1.000 and 0.0100, in contrast with those of the others whose error values were below these values. The results from the moving window krigingshowed a comparable improvement in which AMWKK yielded the best estimation with an improvement equal to 2.3226% relative to the OK model. A similar trend of results was observed in the case of humidity, as shown in Table 2. The moving window kriging approaches continued to outperform the OK method, with relative RMSE improvements between 3.6795% and 5.5571%. When comparing the moving window krigings, the AMWKK method exhibited better results than the MWK and MWKK techniques, with the estimation quality regarding NMSE statistics being improved by 2.7044% and 3.9727%, respectively. The results from both cases indicate that the improvement in the moving window kriging was achieved by exploiting the moving centroids. To further investigate the estimation effectiveness of all methods, we present the spatial distributions of Thailand's averages hourly pressure and humidity in 2018. The study area was systematically divided into square cells measuring 0.25 degrees per side, roughly equivalent to 5.5 square kilometers each. After the longitude and latitude of the grid center point were identified, the pressure and humidity values were then estimated using all four methods at these locations. The spatial distribution maps of the estimation results were created using the QGIS software (Version 3.34.0) [39; 40; 41; 42; 43]. The spatial interpolation maps for annual averages from hourly pressure are displayed in Figure 5. The pressure values ranged from 941.45 to 1071.40 hPa. The lowest pressure value (941.45 hPa) was found in the north, while the highest (1071.40 hPa) was in the south. Since forested mountains are the main geographical features of the northern and \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Interpolation Method** & **Mean MAPE (\%)** & **Mean RMSE** & **Mean PAEE** & **Mean NMSE** & **R\({}_{\textbf{I}}\) (\%)** \\ \hline OK & 1.0243 & 14.7254 & 0.0101 & 0.6393 & - \\ MWK & 0.9910 & 14.4277 & 0.0098 & 0.6176 & 2.0218 \\ MWKK with k = 6 & 0.9841 & 14.5030 & 0.0097 & 0.6238 & 1.5102 \\ AMWKK with k = 6 & 0.9822 & 14.3834 & 0.0097 & 0.6128 & 2.3226 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Performance of different interpolation methods for annual pressure data in 2018. Figure 3: The Calinski–Harabasz index of K-means clustering: (**a**) pressure and (**b**) humidity data.