## 2 Analysis of Entropy Calculation for Special Terrains in Small Windows  
The basic equation for Shannon entropy is as follows:  
\[\left\{ \begin{array}{l}H=-\sum\limits_{i=1}^{n}P_{i}\text{log}\,P_{i}\\ P_{i}=\dfrac{R(i)}{\sum_{i=1}^{M}R(i)}\end{array} \right. \tag{1}\]  
Elevation Terrain Entropy:  
The elevation-based method for calculating the terrain entropy of grid DEMs involves dividing the elevation value by the sum of all elevation values in a region, and the resulting value is used as \(P_{i}\) in [PERSON]'s entropy equation. In Equation (1), H represents the terrain entropy, \(R(i)\) is the elevation value of point \(i\), and \(M\) is the set of all points within a grid DEM. Relative Elevation Terrain Entropy:  
Relative elevation terrain entropy is calculated based on the elevation terrain entropy. It is noted that in the calculation of relative elevation terrain entropy, \(R(i)\) is the result of subtracting the elevation value of the lowest point in the grid DEM from the elevation value at each point. However, it may lead to division-by-zero errors, so special cases meeting \(\sum_{i=1}^{M}R(i)=0\) should be marked, and the terrain entropy value H in such cases is defined as 0. Elevation Probability Terrain Entropy:  
While calculating the elevation probability terrain entropy, the elevation values of a grid DEM are divided into several levels. The area corresponding to each elevation level is divided by the total area to obtain the probability \(P_{i}\), which is then used to calculate the elevation probability terrain entropy H.  
Slope Terrain Entropy:  
Slopes \(S\) are extracted from a grid DEM at first and then calculated using the ArcGIS method:  
\[\left\{ \begin{array}{l}S=\tan^{-1}\sqrt{p^{2}+q^{2}}*57.29578\\ p=\frac{1}{8g}[(c+2f+i)-(a+2d+g)]\\ q=\frac{1}{8g}[(g+2h+i)-(a+2b+c)]\end{array} \right. \tag{2}\]  
where \(p\) and \(q\) represent the directional partial derivatives in the east-west and north-south directions, respectively. \(g\) is the grid spacing (the resolution of the DEM), and 57.29578 is the truncated result of 180/\(\pi\). The computational grid with these parameters is illustrated in Figure 1.  
Figure 1: Surface scan window. Slope values are then classified into different levels. The classification method can influence the final calculation result, which was not discussed in the present study. The area corresponding to each slope level is divided by the total area to obtain the probability \(P_{i}\), which is then used to calculate the final slope terrain entropy \(H\). As shown in Figure 2, these examples represent local specific terrains that may exist within a large-scale grid DEM. The red box indicates the calculation area of the actual grid DEM. During the process of calculating terrain entropy, we found that errors might occur in some special terrain types. Therefore, we selected these five specific terrain types to validate the shortcomings of the existing grid DEM terrain entropy calculation methods. The numbers in the figure represent the elevation values of the grid DEM. The five illustrative terrains from (a-e) exhibit a change trend from a simple terrain to a complex one. However, the terrain entropy values calculated using the four common methods do not show an increasing trend. Taking the calculation of terrain entropy based on elevation probability for the terrains shown in (b,d) of Figure 2 as examples. In terrain (b), there are three distinct elevation values (1, 2, and 3), each appearing three times, resulting in a total of nine grid cells. Therefore, the terrain entropy for (b) is calculated as follows:  
\[H=-\frac{3}{9}\text{log}\frac{3}{9}-\frac{3}{9}\text{log}\frac{3}{9}-\frac{3}{9} \text{log}\frac{3}{9}=0.918(bit) \tag{3}\]  
In terrain (d), there are also three elevation values (1, 2, and 3), with each elevation occurring three times, for a total of nine grid cells.