# Solar Irradiance Forecasting with Transformer Model
## 2 Dataset and Methods
### Weather Characteristics  
In addition to the data on the amount of solar radiation, the dataset also contained information about the weather. This information consisted of average, maximum, and minimum temperature; air humidity; atmospheric pressure; average, maximum, and minimum wind speed; and wind direction on a given day in the selected location. Figure 2 shows these measured variables over a period of 4 years, where it is possible to see the correlations between the temporal behavior of the individual variables during a day. It was therefore meaningful to include the weather as the input to the neural network. Another important feature for understanding the periodicity of weather and solar irradiance is the day of the year, which should not be directly fed into the input of the neural network and  
Figure 1: Visualization of the thinning of regions on the world map from Google Earth. (**a**) Initial map of regions on the left. (**b**) On the right, the resulting thinned-out map of the regions.  
is transformed prior by Equations (1) and (2). Its preprocessing consists of converting the day of the year to sin and cos features, from which the network can more easily deduce the relationship between the period of the year and the repetition of patterns in weather and solar irradiance [22; 23].  
\[DaySin=\sin\frac{2\pi day}{366} \tag{1}\]  
\[DayCos=\cos\frac{2\pi day}{366} \tag{2}\]  
Figure 2: \(Cont.\)  
Information about wind direction and its speed also cannot be directly fed to the input of the neural network [22]. It is necessary to convert them to a wind vector [24] and then use the resulting vector as input features. The wind vector is defined by Equations (3) and (4), where ws is the wind speed in meters per second, and wd represents the direction of the wind in radians.  
\[wind\ vector_{x}=ws\times\cos(wd) \tag{3}\]  
\[wind\ vector_{y}=ws\times\sin(wd) \tag{4}\]  
For the illustrative purposes of depicting the correlations between weather and the obtained solar irradiance, the years from 1984 to 1987 were used in Figure 2, which neatly captures the relationship between weather and solar irradiance. (The chosen 4-year range covers the initial period of training data; its selection from the available data does not have any deeper significance.) As can be seen from Figure 2, humidity is directly related to the amount of obtainable solar irradiance in such a way that, as humidity increases, cloud cover increases and thus shadows the sun's rays. Therefore, it is also possible to derive the amount of the produced solar irradiance from the humidity. The orange curve in the time-of-year signal represents the DayCos, and the blue curve represents the DaySin as defined by Equations (1) and (2).  
Figure 3 shows the relationship of wind speed to its direction, using a heatmap of the frequency of wind occurrence with a given speed at a certain angle. The graph shows that fast southwesterly winds are the most frequent; they also bring monsoons with them. Figure 4, on the other hand, shows the frequency of the occurrence of wind in the wind vector. As the figures show, the wind direction does not describe the whole circle, and thus, there are no winds blowing directly from the north.  
Figure 3: Visualization of the frequency of occurrences wind of given speed in given directions.  
Figure 2: Visualization of visible correlations between weather variables and solar irradiance.