## 2 Materials and Methods
### Probability Distribution Function Fitting  
Probability distribution fitting is the next step in the process. To this end, the overall procedure is illustrated in Figure 7.  
For a given city and month, the input set of data shown in Figure 7 is collected either from the PVGIS-CMSAF in the case of the DNI or from the PVGIS-SARAH in the case of GHI. Then a prior test is conducted to determine whether the set of data follows a unimodal or a bimodal distribution. Other modalities such as tri-modal distributions will not be considered in this work. The particular selected test is [PERSON]'s dip test, because of the reliability of its results [65]. The test will use a uniform distribution that minimizes the maximum difference between the distribution of the sample that needs to be analyzed and the aforementioned uniform distribution. This is referred to as the \"dip\", and its value will be used to assess the unimodality of the distribution of the sample, as mentioned before. The detailed calculation procedure follows the one explained in [66]. From this, [PERSON]'s dip statistic can be obtained, for which values can range from 0 to 1. The classification criteria used is the following: if the statistic is less than 0.1, it means that the sample has a significant bimodal behaviour. Conversely, the sample can be considered as unimodal. In the case of bimodality, it is frequently difficult or even unfeasible to fit a parametric PDF [67]. In this event, the so-called kernel density estimation is one of the most common non-parametric approaches for estimating the PDF [68], and it is the method of choice in this study. On the other hand, if from [PERSON]'s dip statistic the unimodal distribution of the input sample is concluded, a parametric distribution fitting test will be employed for characterizing the PDF of the satellite radiation data. There are many tools that are useful to assign a parametric distribution to a set of data. Among these tests, we can find the Kolmogorov-Smirnov test, the chi-square test and the Anderson-Darling test, the latter being more powerful among the ones mentioned as it gives more weight to the tails than other tests [69]. This will allow to better factor in extreme solar irradiation values that were registered in the database. Figure 8 illustrates the step-by-step calculation of the Anderson-Darling test statistic and corresponds to the red block labelled \"Apply the AD test\" in Figure 7. The input data to this procedure is the same as shown in Figure 7 in case that the unimodality is confirmed by [PERSON]'s dip test (\(p>0.1\)). Figure 6: Categorization of the DNI and GHI data according to the month and considered city. Source: own elaboration. The Anderson-Darling (AD) test statistic is defined as  
\[AD^{2}=-N-\sum_{i=1}^{N}\frac{2i-1}{N}[\ln(CDF(Y_{i}))+\ln(1-CDF(Y_{N+1-i}))], \tag{4}\]  
where  
\(N\): number of elements in the input data for every city and month through the analyzed period. \(i\): index taking values in the range \(1\leq i\leq N\). \(Y_{i}\): element of the input data sorted in an ascending order. \(Y_{N+1-i}\): element of the input data sorted in a descending order. \(CDF(\ )\): cumulative distribution function (CDF) of a specified PDF, calculated for an element \(Y_{i}\) or \(Y_{N+1-i}\) of the input data. Figure 8: Step-by-step calculation of the Anderson–Darling (AD) test. Source: own elaboration. Figure 7: Step-by-step calculation for distribution fitting. Source: own elaboration. To determine which probability distribution fits for each sample, the AD statistic is calculated assuming it follows a specified distribution. In this study, the 10 most frequent distributions found in the literature were chosen to have the data samples fitted into. Table 5 displays these PDFs and their CDFs for each of the selected distributions:  
As can be seen in Equation (4), the CDFs corresponding to each of the tested PDFs are needed.