# A Kalman Filter-Based Method for Reconstructing GMS-5 Land Surface Temperature Time Series
## 3 Method  
### Kalman Filter-Based Reconstruction Algorithm  
A Kalman filter was used as the reconstruction algorithm in this study. In 1960, [PERSON] et al. [31] proposed the concept of a Kalman filter for the state estimation of stochastic processes. The method has been modified and widely applied in many fields of research and has been adopted as one of the most traditional data assimilation algorithms [32; 33; 34]. The Kalman filter is a sequential mathematical procedure for data assimilation that operates through a prediction and correction mechanism. The filter is sequential because it recalculates the solution each time a new measurement is available without using old data again. This procedure obtains a new estimate of the state from its previous estimate by adding a correction term that incorporates the information provided by new measurements, so that the prediction error is statistically minimized. The Kalman filter addresses the general problem of trying to estimate the state \(x_{n+1}\) of a discrete-time-controlled process that is governed by the linear stochastic difference equation [35; 36]. The evolution over time of the quantity to be estimated is described, expressed by means of a state vector \(x_{n+1}\). The transition between states \(x_{n}\) and \(x_{n+1}\) is characterized by the transition matrix \(A_{n+1}\) and the addition of a Gaussian white noise \(w_{n+1}\) with covariance matrix \(Q_{n+1}\). \[x_{n+1}=A_{n+1}x_{n}+w_{n+1},\;w_{n+1}\;\sim\mathrm{N}(0,Q_{n+1}) \tag{1}\]  
The measurement vector \(z_{n}\) relates to the state of the system \(x_{n}\) through the measurement matrix \(H_{n}\) and the addition of a Gaussian white noise \(v_{n}\) with covariance matrix \(R_{n}\). \[z_{n}=H_{n}x_{n}+v_{n},\;v_{n}\;\sim\mathrm{N}(0,R_{n}) \tag{2}\]  
The random variables \(w_{n}\) and \(v_{n}\) represent the process and measurement noise, respectively. These factors are assumed to be independent (of each other), composed of white noise, and with normal probability distributions. In practice, the process noise covariance and measurement noise covariance matrices \(A_{n+1}\) and \(w_{n+1}\), respectively, might change with each time step or measurement; however, here, we assume that they are constant. The matrix \(H_{n}\) in the measurement Equation (2) relates to the state to the measurement. In practice, \(H_{n}\) might change with each time step or measurement, but, here, we assume it is constant, \(H=1\). \[ \begin{cases}\begin{aligned} E[w_{n}]&=0\\ E[w_{n}v_{n}^{\mathrm{T}}]&=Q_{n}\delta_{n}\\ E[v_{n}]&=0\\ E[v_{n}w_{n}^{\mathrm{T}}]&=R_{n}\delta_{n}\\ E[w_{n}v_{n}^{\mathrm{T}}]&=0\\ E[v_{n}w_{n}^{\mathrm{T}}]&=0\\ \end{aligned}\end{cases}  \tag{3}\]  
where \(Q_{n}\) is the nonnegative covariance matrix of \(w_{n}\) and \(R_{n}\) is the positive covariance matrix of \(v_{n}\). We define \(N\) as the number of days of measurement, then define N as the number of days of measurement, then  
\[Q_{n}=0.5*cov(randn(1,N)) \tag{4}\]  
\[R_{n}=0.5*cov(randn(1,N)) \tag{5}\]  
We define \(\hat{x}_{n+1}^{-}\) to be our a priori state estimate at step \(n\), given knowledge of the process prior to step \(n\), and \(\hat{x}_{n}^{-}\) is our a posteriori state estimate at step \(n\), given measurement \(z_{n}\). We can then define the a priori state as follows  
\[\hat{x}_{n+1}^{-}=A_{n+1}\hat{x}_{n} \tag{6}\]  
The a priori estimate of the error covariance is as follows  
\[P_{n,n-1}=A_{n,n-1}P_{n-1}A_{n,n-1}^{\mathrm{T}}+Q_{n-1} \tag{7}\]  
The a posteriori estimated error covariance is as follows  
\[P_{n+1}^{-}=A_{n+1}P_{n}A_{n+1}^{\mathrm{T}}+Q_{n+1} \tag{8}\]  
In this phase, the new state vector \(\hat{x}_{n+1}^{-}\) and its covariance matrix \(P_{n+1}\) are calculated. For this, the predicted covariance is used to calculate the Kalman gain \(K_{n+1}\). The new state vector \(\hat{x}_{n+1}^{-}\) is calculated adding to the predicted state vector \(\hat{x}_{n+1}^{-}\) and the measurement residual \(z_{n+1}-H_{n+1}\hat{x}_{n+1}^{-}\) scaled with the Kalman gain.