*3.1. Masking*

The masking of outliers in the time series is a common step in most reconstruction methods [20–22]. The risk of not masking outliers is that contaminated reflectance values propagate to the reconstructed time series and result in residual noise. In the context of this study, masking was based on the SCL band. Pixels identified as dark (SCL = 2), vegetated (SCL = 4), not-vegetated (SCL = 5), water (SCL = 6), and unclassified (SCL = 7) were considered as clear. The remaining classes were masked as "not clear": no data (SCL = 0), saturated or defective (SCL = 1), cloud shadows (SCL = 3), clouds (SCL = 8–9), thin cirrus (10), and snow or ice (SCL = 11). To mitigate some of the omission errors in the SCL band at the cloud edges, a distance-based buffer of five pixels (50 m) was added to the masked pixels. Larger buffer sizes of 100–300 m are commonly used, as proposed in [38]. Here, a relatively small buffer was found to be effective (e.g., masking the contaminated observation corresponding to the acquisition on 12 June 2019), without removing a large amount of usable imagery [39].

Part of time series (April to September 2019) of the reflectance in the red (band B4) and near infrared (band B8) as well as the NDVI for a pixel in an agricultural field (red square in Figure 2) is shown in Figure 3. The eight vertical lines correspond to the eight acquisition dates that have been selected in Figure 2. The masked observations are represented as empty dots in Figure 3. Some of them can easily be identified as outliers, based on the time series in Figure 3. For instance, the observation corresponding to 6 August 2019 (vertical line 6) has a higher reflectance value than expected from the time series (see Figure 3d). This observation was indeed identified by Sen2Cor as cloudy (with medium probability: SCL = 8). Furthermore, masked were the observations acquired on 7 July 2019, 17 July 2019 (thin cirrus: SCL = 10) and 21 August 2019 (SCL = 8).

**Figure 3.** Reconstruction of NDVI (top) and spectral bands B4 and B8 (bottom). Vertical lines correspond to selected acquisition dates in Figure 2. Masked pixels are interpolated to fill gaps in the time series (left column). The iterative reconstruction process (middle column) checks whether observations are trustworty (green) or not (orange) based on the NDVI value. The NDVI values in green that are above the orange long-term change trend curve (SG) are retained for the next iteration. Those in red that are below will be replaced by the corresponding values on SG curve. Reconstructed time series (right column) for the proposed RTSR method (in blue) compared to SG (orange) and the dynamic temporal smoothing (DTS, in green).
