## 2 Materials and Methods
### Case Study Definition and Data Collection and Validation
The statistics used for the validation process are the mean absolute deviation (MAD), the mean bias deviation (MBD) and the root mean square deviation (RMSD), which are widely used in the validation process of satellite-based data with ground-based data [52]. These are calculated using the following expressions:  
The mean absolute deviation (MAD):  
\[MAD=(1/n)\ \sum_{i=1}^{n}\abs{x_{i}^{a}-x_{i}^{b}}, \tag{1}\]  
The mean bias deviation (MBD):  
\[MBD=(1/n)\sum_{i=1}^{n}\left(x_{i}^{a}-x_{i}^{b}\right), \tag{2}\]  
The root mean square deviation (RMSD):  
\[RMSD=\sqrt{\left(1/n\right)\ \sum_{i=1}^{n}\left(x_{i}^{a}-x_{i}^{b}\right)^{2}}, \tag{3}\]  
where \(n\) is the amount of data in the set, \(x_{i}^{a}\) is the data from set \(a\) and \(x_{i}^{b}\) is the data from set \(b\). It should be noted that each data set has different intervals. These are 11 years for the PVGIS-SARAH data set, 6 years for the PVGIS-ERA5 and 9 years for the PVGIS-CMSAF data set. Therefore, the value of \(n\) will be the lower one when computing the MAD, the MBD and the RMSD between two data sets. The results of calculating the former statistics for the different pairs of data sets are shown in Tables 3 and 4 for the DNI and the GHI cases, respectively. As it can be seen in Tables 3 and 4, the deviation between the data sets is lower in the case of GHI than in the case of DNI. Additionally, the blue dots in each of the subplots in Figure 5 correspond to the various months within the analyzed time intervals for selected cities, and their coordinates are the radiation values retrieved from the databases represented in the horizontal and the vertical axis, respectively. The subplots located at the left side of Figure 5 refer to DNI values while those at the right side relate to GHI values. The position of the represented data and its dispersion illustrates the degree of mismatch between the compared databases. Additionally, the corresponding linear regression has been determined, helping to visualize the existing relationship between the databases. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline \multicolumn{1}{c}{} & \multicolumn{4}{c}{**CM-SAF and ERA5**} & \multicolumn{4}{c}{**SARAH and ERA5**} & \multicolumn{4}{c}{**SARAH and CM-SAF**} \\ \hline
**City** & **MAD** & **MBD** & **RMSD** & **MAD** & **MBD** & **RMSD** & **MAD** & **MBD** & **RMSD** \\ \hline Agadir & 6.51 & 1.30 & 8.30 & 6.06 & 0.89 & 7.53 & 3.87 & 0.55 & 5.35 \\ Al H\oeima & 7.54 & 4.80 & 8.93 & 6.05 & \(-\)2.51 & 8.96 & 6. It is possible to observe that the GHI data have less dispersion than the DNI, suggesting that for all the databases, the GHI values seem more reliable than the DNI ones. Using the numerical results from Tables 3 and 4, it can be stated that those pairs of databases involving PVGIS-SARAH for the GHI and PVGIS-CMSAF for the DNI accumulate the higher number of error metrics with lower average values for all the analyzed cities. Consequently, it seems convenient to use the PVGIS-CMSAF in the case of the DNI and the PVGIS-SARAH in the case of GHI. As can be seen in Figure 6, the selected DNI and GHI databases are then categorized into several sets, according to the month and the considered city. A total number of sets corresponding to 12 months by 23 cities is created for both DNI and GHI radiation data. The size of each of the sets amounts to the number of years collected in the CMSAF and SARAH databases, i.e., 9 and 11 years, respectively. Once the classification of the data is complete, the process to determine the probability distribution function (PDF) will be explained next. Figure 5: Monthly irradiation values within the analyzed time intervals comparing pairs of databases and linear regression for the validation of data. Source: own elaboration.