The STL Decomposition Method (STLd)

STL is a flexible, iterative non-parametric and robust method developed by [40] to decompose time-series into three components, according to an additive model:

$$\rm{TS}\_{\rm l} = T\_{\rm i} + S\_{\rm l} + R\_{\rm i} \tag{3}$$

where TSi is the time-series of i-th pixel of IR frame, Ti is the Trend, which represents a general tendency of data to move in a certain direction, Si is the Seasonality, which is a repetitive pattern over time due to exogenous causes, and Ri is the remainder, e.g., TSi removed of Trend and Seasonality components (Matlab© function: 'step04.m').

The stl() function is available in the R statistical programming language [41]. STL is an acronym for "Seasonal and Trend decomposition using Loess", where Loess is a method for estimating nonlinear relationships. The Loess (LOcal regrESSion) algorithm performs smooth estimate *g*(*t*) for temperature T at all times t, not just at time ti for which T has been observed. There are several parameters to set in the STL algorithm [40]. The main parameters are the number of observations *n.p* per seasonal cycle, the trend window (*t.window*) and the seasonal window (*s.window*). These last two parameters specify how quickly the trend and seasonal components can change. In different words, *t.window* is the number of consecutive observations to be used when estimating the trend; *s.window* is the number of consecutive years to be used in estimating each value in the seasonal component.

The 'standard' use of STL function in R is: *stl(time-series, s.window = "periodic").* By using the setting *s.window = "periodic"*, Loess smoothing is effectively replaced by the mean of the seasonal sub-series. This way, STL assumes the same seasonal cycle for each year of the time-series; therefore, the seasonal component for January is simply the mean of all January values and similarly for the other months.

STL can be set to be robust to outliers, so that occasional uncommon observations will not affect the trend and seasonal components, but only the remainder component.

As the STL algorithm was developed in R language only, a specific script was created to integrate the STL function into the Matlab© processing procedure. The script ('step04.m') consisted of two parts: a) Matlab© code which calls b) R code by using a Matlab toolbox (*RunRcode*, Matlab File Exchange).

When calling the STL function ('STLIR.R'), the *s.window* parameter was set to *'periodic'* and the *t.degree* was set to 0. This last one parameter is the degree of locally-fitted polynomial in trend extraction. Moreover, it was important to set the periodicity when creating the temperature time-series in R script. For TIRNet temperature data, the periodicity was set to 365.

STL needs at least a two-year long, continuous time-series; otherwise, it does not process the dataset. If the dataset is not continuous, due to data lack in some periods, it has to be resampled daily. In case of shorter dataset, only BKGr method can be applied.

The STLd procedure can be simply applied to statistical time-series (e.g., raw maximum temperatures time-series; Figure 5) or applied to time-series of all pixel temperatures of the IR frames by using the processing scheme reported in Figure 6.

**Figure 5.** STL decomposition procedure applied to Pisciarelli station: RAW maximum temperature of IR scene (grey color) and de-seasoned maximum temperature of IR scene (blue color).

**Figure 6.** Processing scheme used to remove seasonal component of TIRNet data by using R script including STL procedure ('STLIR.R') and Matlab code. 1) Evaluation of seasonal component (S) by applying STL to background area. 2) Removal of S to a pixel raw temperature in order to get the de-seasoned values.

The STLd procedure used to remove seasonal component of all pixels from IR time-series (Figure 6) required, as a first step, the evaluation of the average temperatures time-series of BKG (TavBkgTS). The STL function was then applied to the TavBkgTS time-series to decompose it into three components:

$$\text{TavBkgTS} = \text{TrendBkgTS} + \text{SeasonBkgTS} + \text{RemBkgTS} \tag{4}$$

where TrendBkgTS, SeasonBkgTS and RemBkgTS are, respectively, Trend, Seasonality and Remainder time-series of TavBkgTS.

As the background area is not influenced by thermal anomaly, the SeasonBkgTS can be assumed to be representative of the seasonal component affecting all pixels of the frames acquired by an IR station. This assumption makes it possible to apply the following relation:

$$\mathbf{T\_{des}}\,\mathbf{TS\_{l}} = \mathbf{T\_{i}}\,\mathbf{TS - SeasonBkgTS} \tag{5}$$

where TdesTSi is the de-seasoned time-series of ith pixel of IR frame and TiTS is the time-series of raw temperatures of the same pixel.

In brief, STLd procedure removed the seasonal component to temperature time-series from all the pixels of IR frames, acquired by a IR station, by subtracting the seasonal component of BKG (SeasonBkgTS). Additionally, in the STLd method, the correct choice of the BKG is fundamental. A direct control of BKG quality is to plot the values of TrendBkgTS: they must be without significant variations (Trend plot in Figure 6).

The final result is a Matlab© 3D array representative of IR frames with de-seasoned temperature values. These arrays are relevant to perform advanced pixel-to-pixel processing methods, needing de-seasoned IR data, which are reported in the next steps.

Additional output of processing step 5 is a map showing locations of maximum temperatures values detected in all IR frames.
