# A CNN-Based Downscaling Model for Macau Temperature Prediction Using ERA5 Reanalysis Data
## 3 CNN Model Construction and Training  
### Interpolation Methods  
In grid data processing, the choice of interpolation algorithms needs to be closely coupled with the constraints of grid type (structured or unstructured), data continuity requirements, and computational efficiency. For structured grids (e.g., uniformly distributed 2D or 3D grids), traditional image interpolation methods can be directly migrated to applications. Traditional interpolation methods, such as nearest-neighbor interpolation, bilinear interpolation, and cubic spline interpolation, will be compared with deep-learning-based approaches [14; 15].  
Nearest-neighbor interpolation is a fast interpolation method based on the principle of discrete sampling [16].  
\[f(x,y)=f(\text{round}(x),\text{round}(y)) \tag{1}\]  
The core idea is to map the target point \((x,y)\) to the integer coordinate point (round\((x)\), round\((y)\)) with the nearest Euclidean distance in the original grid and inherit the value of that point directly.  
This method has low computational complexity and does not require the introduction of additional smoothing but may lead to step artifacts (Aliasing) in the interpolation results. It is suitable for scenarios that require high computational efficiency and allow for the preservation of discrete features of the data (e.g., low-resolution image zooming or categorical label interpolation) [17].  
Bilinear interpolation achieves a continuous smooth interpolation effect by local linear weighting [18]. In this study, the parameterization of bilinear interpolation was implemented directly using Equation (2).  
\[f(x,y)=\frac{y_{2}-y}{y_{2}-y_{1}}f(x,y_{1})+\frac{y-y_{1}}{y_{2}-y_{1}}f(x,y_ {2}) \tag{2}\]  
If we want to find the value of the unknown function \(P\) at the point \((x,y)\), suppose we know the values of \(P\) at four points \(Q_{11}=(x_{1},y_{1})\), \(Q_{12}=(x_{1},y_{2})\), \(Q_{21}=(x_{2},y_{1})\), and \(Q_{22}=(x_{2},y_{2})\) (as in Figure 2) [19]. And the parameters \(f\) (\(x,y_{1}\)) and \(f\) (\(x,y_{2}\)) of Equation (2) are calculated from Equations (3) and (4).  
\[f(x,y_{1})=\frac{x_{2}-x}{x_{2}-x_{1}}f(Q_{11})+\frac{x-x_{1}}{x_{2}-x_{1}}f(Q _{21}) \tag{3}\]  
\[f(x,y_{2})=\frac{x_{2}-x}{x_{2}-x_{1}}f(Q_{12})+\frac{x-x_{1}}{x_{2}-x_{1}}f(Q _{22}) \tag{4}\]  
The method finally generates a continuously differentiable interpolated surface. It is computationally efficient and can suppress the jagged effect, but it may blur the high-frequency details and is suitable for natural image resampling or continuous physical field reconstruction [20].  
Cubic spline interpolation is an efficient smooth interpolation method for one-dimensional data [21], and it can also be extended to 2D data like the method of bilinear interpolation described above. Its core idea is to divide the interval between data points into several small segments and construct an independent cubic polynomial function on each small segment, so that the adjacent segments not only have continuous function values at the connection point (i.e., the original data points), but also ensure the continuity of the first-order and second-order derivatives [22].  
The advantage of cubic spline interpolation lies in its smoothness and localization, and it is widely used in fields that require high-precision smoothing of curves, such as contouring in mechanical engineering, time-series analysis of financial data, generation of motion paths in animation, and fitting processing of scientific experimental data [23].