## 2 Materials and Methods
### Procedure Used to Apply the Clustering Algorithms  
The pre-processing carried out on the data was to eliminate from the analysis those days in which the records are null, due to some type of failure in the monitoring system or due to disconnection for maintenance work. In this regard, data from 3237 of the total of 3322 days comprising the monitoring interval were available for the study.  
The classification methodology used consisted of two types of groupings. Firstly, the set of 3237 days was divided, using the _k-means_ algorithm, into three categories, taking into account the value of the total daily irradiance as a classification index. Based on this value, the days were classified into three types. Type H, M and L, corresponding respectively to high, medium and low total daily irradiance. As indicated above, this classification was carried out using the sklearn.clusters module of the Scikit-learn library. As previously indicated, the initialisation of the centroids was carried out using the k-means++ method, and the Euclidean metric was used.  
Once this classification was carried out, a second clustering process was made within each of the three categories obtained. For this second classification, the variations in the instantaneous irradiance values recorded throughout the day were taken into account. To do so, the value of the irradiance at each moment in time was subtracted from its value immediately before, and with the absolute value of these differences, a set of time series was obtained for each day, with 287 records. It is an index which represents the variability of the irradiance that takes place throughout the day. These variations in irradiance values are due to the passage of clouds, and give rise to random variations in the PV plant output. Then, the series corresponding to each of the three groups of days of categories H, M and L made previously, were classified again into three other categories. This second classification corresponds to days of low, medium and high irradiance variability, denoted by 1, 2 and 3, respectively. Thus, the total of the 3237 days finally analysed will be automatically grouped into a total of nine categories denoted as H1, H2, H3 (days with high total daily irradiance, and with low, medium and high variability of irradiance, respectively); M1, M2, M3 (days with medium values of total daily irradiance, and with low, medium and high variability of irradiance, respectively); and L1, L2, L3 (days with low total daily irradiance, and with low, medium and high variability of irradiance respectively). This set of nine types of days allows the variability of existing daily irradiance profiles to be gathered, but in a general way, so that, based on the time of year and weather forecasts, it can be easy to predict in advance the type of day that is going to occur.  
As this second classification is not a point-to-point classification, but a time series classification, the TimeSeriesKMeans algorithm, which is a variation of the original _k-means_, adapted to time series clustering, was now employed. This classification was performed with the DTW metric described above. The tslearn.clustering module belonging to the ts-learn library was used for this second clustering process.