## 2 Materials and Methods
### Case of Study  
A microalgae-based wastewater treatment model is the focus of our case study. Modeling such a system can be beneficial in anticipating potential obstacles and making decisions regarding its implementation.  
According to [23], more than 80% of total nitrogen and 70% of total phosphorus in wastewater are removed in 5 days, with a biomass productivity equal to 0.64 gL\({}^{-1}\)d\({}^{-1}\) for batch culture. In addition, [PERSON] et al. obtained a significant result of 1.72 gL\({}^{-1}\)d\({}^{-1}\) of microalgae biomass produced during batch treatment and proposed that a hydraulic retention time of 7 to 9 days could be efficient for nutrient removal and microalgal biomass production during continuous treatment [24]. In our case study, long-term climate variability of air temperature and PAR was taken into account by generating a set of n-GMS consisting of seven consecutive days generated according to the methodology proposed in [19]. The methodology offers a significant number of seven-day sequences for every season of the year, with 1204 for spring, 1204 for summer, 1190 for autumn, and 1184 for winter, taking the following approach.  
\[EA=\{d_{1},\ d_{2},\ d_{3},\ \ldots d_{n}\}\] \[S_{1}=\{d_{1},\ d_{2},\ \ldots d_{7}\},\ \ S_{2}=\{d_{2},\ d_{3},\ \ldots d_{8}\}\ \ \ldots\ S_{m}=\{d_{n-6},\ d_{n-5},\ \ldots d_{n}\}\]  
where \(EA\) corresponds to all the days available (n) for a given season and \(S_{m}\) is a set of a sequence of 7 consecutive days (with \(m=n-6\)).  
The Filkenstein-Schafer statistic (FS) and a persistence criterion were applied to determine the most typical sequence in the series:  
\[FS=\frac{1}{N}\sum_{i=1}^{N}\delta_{i} \tag{1}\]  
where N is the number of days in a week (N = 7). \(\delta_{i}=|CDF_{e}(x_{i})-CDF_{e,s}(x_{i})|\), with \(CDF_{e}\) and \(CDF_{e,s}\) as the long-term and short-term CDFs for each weather parameter x. For each sequence, Equation (2) was calculated for all seasons and all weather parameters studied. According to the FS statistics, the CDF of each parameter \(x\) with n observations and then arranged in ascending order \(x_{1},x_{2},\ldots,x_{k-1},x_{k}\) is given by a function \(S_{k}(x)\) defined by:  
\[S_{n}(x)=\left\{\begin{array}{cl}0&for\ x<x_{1}\\ (k-\
icefrac{{1}}{{2}})/n&for\ x_{k}\leq x\leq x_{k+1}\\ 1&for\ x>x_{n}\end{array}\right. \tag{2}\]The weighted sum (WS) of the FS statistics corresponding to each parameter \(FS_{i}\) was calculated by applying a weight factor \(wf_{i}\).  
\[WS=\sum_{i=1}^{m}wf_{i}\cdot FS_{i} \tag{3}\]  
The persistence is evaluated by determining the number of occurrences of a given sequence. In this case study, each of these sequences was used to obtain algal biomass production and evaluate the variability of productivity. This approach is described in more detail in Sections 2.3 and 2.4.  
In addition, a seven-day PAR and temperature variation data set was obtained from 15-year remote sensing data, with a spatial resolution of \(0.125^{\circ}\times 0.125^{\circ}\). PAR data were obtained from Kato bands, provided by the spectral resolved irradiance (SRI) of the Satellite Application Facility on Climate Monitoring (CMSAF), which belongs to the European Organisation for the Exploitation of Meteorological Satellites (EUMETSAT). The temperature values were sourced from the Copernicus Climate Change Service (2023): ERA5 hourly data.