# Prediction of Intraday Electricity Supply Curves
## 3 Methodology
### Preprocessing
#### 3.2.2 Data Preprocessing  
The first step taken before preprocessing was to verify that all the files in our interest existed and that these files were in the correct format (for example, not empty); we did not find any errors.  
Once that was carried out, the following process was carried out for each of the files. Once the file was read as a.csv file, we filtered the data to retain only the sell offers from the original offer curve (not the resulting matching program). Then, the numerical values were changed from the Spanish number format to the English one. Moreover, the numerical data were formatted into Python's float type, and the names of some variables were shortened.  
Then, the offers were grouped by day and hour, grouping them again into larger 24-h blocks (day by day). However, this poses a problem. In Spain, the clocks are set forward 1 h in the spring and set back 1 h in the fall [24]. Therefore, the affected dates have a different number of hours, which may conflict with our desired homogeneous data format. The specifics are as follows:  
* The markets with a 24 h application horizon (the daily market and the first and third intraday markets) are affected by these time changes. Some days have 23 h, while others have 25. Since these represent a tiny percentage of the total dates, we chose to remove the last hour on 25 h days and duplicate the last hour on 23 h days, ensuring we always had 24 h.
* The second daily market, with its 28 h application period spread over 2 days, required a more detailed examination. Its application horizon covers an entire day and the last 4 h of the previous day. This market is only affected by time changes when they impact the 24 h day it applies to, resulting in markets with either 27 or 29 sessions. We handled this full day in the same way as the 24 h horizon markets.
* The offers and demands in the intraday markets with a horizon of less than 24 h (the fourth, fifth, and sixth) pertain to the respective last hours of the day, and therefore, these markets are not affected by the time changes. However, on 10 October 2022 (the clocks were set back on this date [24]), the fourth intraday market conducted 21 h instead of 20. Given the minor nature of the issue, we addressed it by removing the first hour and keeping the last 20, which is in line with the market structure and the format of our data.  
Another potential issue is that, due to anomalous situations, technical complications, or regulatory changes, a day might have an abnormal number of sessions. Fortunately, there were no such problems in our date range.  
Once the issues related to temporal homogeneity had been assessed, each hourly block was sorted in ascending order by offer price. Next, we normalized the price values and summed the energies corresponding to these prices cumulatively, replacing the original energy value and finally obtaining the offers curve. We merged the hourly blocks into a larger dataframe of 24 h and attached this block to all the previous ones, creating a single dataframe for all prices and another for all energies (logically, this process is carried out once for each market).  
It should be noticed that the dimensions of these dataframes are not homogeneous since they vary depending on how many different prices are present in the corresponding session. Structural homogeneity in our data is addressed in Section 3.2.4.