Summer heatwaves, wind production and electricity demand in Southern Europe: climatic conditions and impacts

Electricity demand for cooling and heating is directly related to weather and climate, primarily through ambient temperature. In Southern Europe, the maximum electricity demand for cooling in summer can be more pronounced than in winter, especially during heat wave (HW) episodes. With the growth of renewable technologies in the energy mix, the dependency of the electricity system on the weather is becoming evident not just from the demand side, but also from the energy supply side. From the resources point of view, summer wind presents a minimum on its annual cycle, so a combination of maximum electricity demand can coincide with a minimum of wind power production. This study presents a strong multidisciplinary focus, merging climate, energy and environmental discipline, due to their relevant connections in Southern Europe where important climate change stresses are expected. The combined anomalies of electricity demand and wind production during heat wave episodes are quantified at the country level, taking into account the HW extension. The summer period (1989-2019) of ERA5 reanalysis and E-OBS-21.0e data is used for atmospheric magnitudes and the Copernicus climate change service (C3S) energy dataset for demand. In heat wave events, an increase of 3.5%–10.6% in electricity demand and a decrease up to −30.8% in wind power production is obtained, with variability depending on the country. The greater the extension of the HW, the greater the anomalies. Different weather regimes related to heatwaves also play a role on this range of values. Therefore, the impact of extreme weather events, such as heatwaves, on wind power production in conditions of high electricity demand, should be considered in the energy supply strategy and planning in order to minimize the impact of these events on an electricity system with high penetration of renewables.


Introduction
In recent years, a transition of the energy model is taking place in Europe towards an increase in renewable energy within the energy mix. This makes electricity generation increasingly dependent on meteorology and natural variability of resources like wind or irradiation (Pryor et al 2006, Jerez et al 2013, Bloomfield et al 2016. On the other hand, energy demand is highly related to temperature, especially its extremes. In this context, it is important to understand the nature and combined variability of these atmospheric variables involved in energy supply and demand. In terms of the energy transition, solar and wind power are the renewables more important (Bouckaert et al 2021). Solar energy is growing faster in the last years, however, there is still more wind installed in Europe (IEA,I. Unsd,world bank,who 2023). The power generation from solar energy is characterized by diurnal and seasonal cycles, with its maximum in summer. In contrast, wind power variability depends on the fluctuations over a wide range of temporal and spatial scales of wind speed and direction in the first tens to hundreds of meters above ground (Jerez et al 2013). Clear annual and daily wind cycles characterize the seasonal variability, with more production in winter than in summer (Holttinen 2005, Molina et al 2021 and daylight hours windier than the night ones (Pryor et al 2006, Kiss and Jánosi 2008, Bett and Thornton 2016, Marcos et al 2019. Wind power production on a country scale is also related to the distribution of wind farms (Holttinen 2005) or the wind speed thresholds in which the turbines can operate (Commission et al 2019). Then, a greater spatial spread of the turbines can compensate and reduce the variability, as well as mitigate the periods of low wind energy production (Brown et al 2021, Ohlendorf andSchill 2020), which can be challenging during peaks of demand.
Previous works -mainly over the north-Atlantic region of Europe- (Thornton et al 2017, Grams et al 2017, van der Wiel et al 2019a, 2019b, Bloomfield et al 2020 have studied the relationship of wind power production to large-scale pressure conditions on multi-daily scales using the weather regimes (WRs) methodology. They show that lower wind power generation in winter is related to blocked circulation patterns, and greater generation is related to cyclonic regimes. Most of these studies are focused on the winter months, with higher and more persistent atmospheric conditions, together with higher and more stable energy demand (due to heating) in Europe (Staffell and Pfenninger 2018, Tedesco et al 2022. Few studies have looked at the summer WRs (Cassou et al 2005, Guemas et al 2010, Cionni et al 2020, since they present a lower persistence than those of winter (Mukougawa and Sato 1999). Summer WRs have not been studied in relation to wind power production but rather to the frequency of hot extremes, across Europe in Horton et al (2015), Alvarez-Castro et al (2018), and over the Iberian Peninsula in Sánchez-Benítez et al (2020). They found that summer extreme heat events are more frequent during WRs associated with a ridge or blocking pattern over Central Europe. In Cassou et al (2005), European heatwaves (HWs) are associated with two atmospheric circulation regimes: the Blocking (NAO+), such as the low-wind conditions mentioned above, and the Atlantic Low. Summer radiative warming coupled with increased insolation explains the temperature responses for both blocking and ridges , especially in continental regions.
In most Northern and Central European countries, the demand for electricity increases in winter due to heating needs. On the contrary, in the countries of Southern Europe as well as in continental areas, the demand also increases in summer for refrigeration (Leahy and Foley 2012). Besides, HWs in Europe present a strong north-south gradient and are expected to increase in the future due to climate change, especially in the Mediterranean region (Molina et al 2020). Therefore, a demand analysis for the entire continent can be very misleading.
Climate change is expected to have a significant impact on both generation ( Damm et al (2017), it is shown that despite the annual energy demand averaged for the whole of Europe would decrease due to the reduction of the heating demand for most countries under climate change conditions, in the Southern European countries, a warmer climate leads to a marked increase in electricity demand due to higher cooling needs. Therefore, despite the balance on total European consumption is almost null, a polarization between Northern and Southern European countries is expected in the peaks of demand and consumption (Wenz et al 2017).
In summary, the combination of summer climatic minimum of wind resource, maximum energy demand and frequent HW conditions over the Euro-Mediterranean region, could be relevant in terms of power supply risk over those regions . Since wind power is becoming more and more important, together with the growth of HWs in length and intensity under climate change conditions in the Euro-Mediterranean region, the objective of this work is to analyse the summer wind power production and electricity demand under present HW conditions in Southern Europe.
The article is structured as follows: the multiple data sources and the methodology employed are shown in section 2. The impact of HWs on electricity demand and wind power of the most important Southern European countries is analysed in section 3.1. Then, summer weather regimes and, in particular, its relation with HWs and their impact on the electrical system are shown in section 3.2. Section 3.3 focuses on the impact of the most extreme HW events on demand and wind production as a case of study. Finally, section 4 provides the main conclusions of the results.

Data and methods
2.1. Data Different datasets in a regular grid of 0.25 degrees are employed in this work. The source of the energy variables is the ERA5 reanalysis. Modelled electricity demand data are obtained from the C3S product, while wind production is calculated from the wind modules at 100 m of altitude. In the case of the climate variables, gridded observed data of maximum temperatures from the EOBS dataset are used to select the HW days, and the geopotential height at 500 hPa from ERA5 reanalysis for the WRs computation. Furthermore, estimations of the human population in a 15 arc-min resolution (28 km) are extracted from The Gridded Population of the World, Version 4 (GPWv4), to select the EOBS grid points where population or industries are present. Electricity demand and wind production data at the country level, that is, accumulated for the whole state, are used to compute anomalies in HW days regarding summer days. HW days for each country are selected considering its spatial extension.

Electricity demand data
Electricity demand represent the mean power consumed on the electrical grid. The electricity demand data used in this study are obtained from the European programme Copernicus climate change service (C3S, https:// climate.copernicus.eu/) energy dataset. In particular, the historical dataset product is modelled at the national level, using Generalized Additive Models, by transforming the climate variables (temperature, precipitation, wind speed, radiation and mean sea level pressure) from the hourly ERA5 reanalysis (Hersbach et al 2019), following the approach developed in the European Climatic Energy Mixes project (ECEM, (Troccoli et al 2018)). This approach requires electricity demand data from observations to set up and validate the model. The data used for this purpose are from the European Network of Transmission System Operators (ENTSO-E) Power Statistics database (https://transparency.entsoe.eu/), the European reference institution, retrieved from the Monthly Hourly Load Values. More details about the procedure can be found in Copernicus Climate Change Service (2017).
With the aim to analyse the impact of heatwaves on the electricity system, the electricity demand daily data (daily energy consumption in MWh) at the country level for the 1989-2019 period are employed. The Southern European countries with available energy data are: Greece, Portugal, Spain, Italy, Croatia, Hungary, Bulgaria, Serbia, Montenegro, Romania, Turkey and Macedonia. The use of modelled data instead of real data for this work is due to the difficulty in obtaining energy data with a consistent temporal and spatial resolution for a long period of time.

Temperature data
Daily maximum temperatures variable from E-OBS-21.0e data (EOBS, (Haylock et al 2008); http://www.ecad. eu/) are employed to calculate HW days. E-OBS is a land-only observation database in a 0.25-degree regular grid, based on European Climate Assessment and Dataset (ECA&D) daily station data. The station data are sourced from the European National Meteorological and Hydrological Services and other data holder institutions. E-OBS covers Europe and the Mediterranean area since 1950, although the 1989-2019 common period for all databases is used here.

Wind speed data
The ERA5 reanalysis ((Hersbach et al 2019), https://cds.climate.copernicus.eu/) hourly wind components u and v at the standard turbine height of 100m (1989-2019) are used to calculate daily wind speed, to allow for a spatially wide wind field, since the observational data are scarce throughout the domain (Molina et al 2021).
ERA5 is a high-resolution reanalysis with a grid spacing of 31 km (0.28 degrees). It has been shown to reproduce the observed wind variability better than other reanalyses ( , especially over mountainous areas. As wind power generation mainly depends on the wind speed, installed capacity and the turbine model, this misrepresentation of wind speed values by ERA5 could underestimate or overestimate wind power production (Murcia et al 2022). Therefore, a bias correction to ERA5 long-term mean wind speed is made at each grid cell to match the corresponding Global Wind Atlas 3.0 (GWA, (Badger et al 2015)) value (wind speed at 100 m). In order to retain the temporal variability of the reanalysis while integrating the mean wind speed data from the wind atlas, the wind data from ERA5 has been multiplied by the GWA to ERA5 ratio, as in Lledó et al (2019).

Heatwaves (HWs)
According to the World Meteorological Organization (WMO 2015), an HW is a hot extreme weather event with marked warming of the air over a large area that lasts from a few days to a few weeks. The temperature has to be clearly above the usual values and, therefore, high percentiles are needed to characterize this type of event. There are different methods to characterize heatwaves (HWs, Zhang et al (2011), Perkins (2015, Ouzeau et al (2016)), and they can be tailored to the sector of interest: human health, infrastructures, electricity supply, transport, agriculture or natural ecosystems (Perkins and Alexander 2013). Here, HWs are defined as events when at least three consecutive days exceed the 90th percentile value of the maximum daily temperature in a 31-day moving window during the reference 1971-2000 period. This is a simplified definition that takes into account the extension and magnitude of the HW, compared with the more complex ones used in Perkins and Alexander (2013) and Molina et al (2020). HW days for the period 1989-2019 are calculated for each grid cell with the R (Core Team 2019) package 'heatwaveR' (Hobday et al 2016).
A graphic summary of the methods employed can be seen in figure 1. HWs are analysed in relation to their potential impact on the electricity supply (Savić et al 2014). Thus, the spatial extent of the event is important because the larger it is, the more industries and populations it may concern. First, HWs are computed in those cells that present more than the 60th percentile of the 2015 country's population density (number of persons per square kilometre, available at Center for International Earth Science Information Network (2018) in a 15 arcminute resolution (28 Km)). Then, HW extension is considered specifically for the grid points where population or industries are present, with the aim to study their effect on energy demand. As in Schoetter et al (2015), days of HW affecting at least 30% of the surface country studied are investigated, using that threshold to focus only on potentially harmful HW events. Furthermore, the impact of HWs that affect 50% and 75% of the countryʼs population is examined to study the sensitivity of heatwave extension on the electricity system. The usage of spatial extent and population density to determine a heatwave event is a relevant aspect of novelty compared with other studies. The capacity factor (CF) is defined as the ratio of total produced energy (E tot ) to the maximum production that could be achieved if the wind power plant were operating at full capacity all the time. The method for computing the capacity factor is to use a power curve that relates power output to wind speed at hub height (V ). From those established by the international standard IEC-61400-1 (Commission et al 2019), a different power curve is selected for each grid cell depending on the long term wind speed average: 10 m S −1 for turbine type I, 8.5 m S −1 for type II and 7.5 m S −1 for type III. A power curve establishes different regimes in a wind turbine: below the cut-in (V I ) wind speed there is no production; above the cut-in, the wind potential grows up to the rated speed (V R ), the maximum wind speed production. Between the rated and cut-out (V O ) wind speed, the production is equal to the installed capacity. Above the cut-out, the production needs to be shut down to prevent damage to wind turbines (Manwell et al 2010).
Then, the wind power capacity factor is calculated from the ERA5 bias-corrected wind speeds at each grid cell using three different power curves from the IEC-61400-1. The total generation is obtained by multiplying the CF by the installed capacity (C inst , obtained from Dunnett et al (2020), the first open-access database from official governments data and independent global sources, integrated with open collaborative data such as analysis of satellite images) and the number of hours in the period of interest (t). Although installed capacity has clearly grown in recent years (https://transparency.entsoe.eu/), here it is considered constant every year for simplicity. In this way, it does not affect the calculation of temporary anomalies (see the spatial distribution of the wind power installed capacity in figure 2). The country-aggregated wind power series are obtained by summing the hourly cell values.

Weather regimes methodology
The ERA5 geopotential height at 500 hPa (Z500) data is used to calculate the daily anomaly patterns of the summer season (JJA), related to HWs, for the 1989-2019 period. The methodology to determine the predominant weather regimes is based on the decomposition of the daily Z500 into empirical orthogonal functions and their grouping through k-means clustering (Michelangeli et al 1995, Cassou et al 2005. First, an empirical orthogonal function (EOF) analysis is applied to the daily Z500 geopotential anomalies. Then, the leading principal components (PCs) that explain 85% of the variance are used for the k-means clustering. The k-means algorithm (Hartigan and Wong 1979) is used to obtain groups of similar anomaly patterns. The JJA weather regimes (WRs) classification of daily Z500 geopotential anomalies over the studied region are obtained by assigning each day of summer for the period 1989-2019 to one of the WRs. The spatial domain used in the WR calculation affects the anomaly patterns obtained. Here, similarly to Garrido-Perez et al (2020), the '45°W-25°E , 30°N-65°N' domain is used to maximize the signal of the WRs on near-surface in Southern Europe, from Iberia to Greece. The domain selection is a sensitive and complex issue, as it can partially modify the WR statistics, as pointed out by Garrido-Perez et al (2020). However, some tests were performed here (including the western Atlantic Ocean area or suppressing Greece and Turkey from the domain, since the chosen area, from Iberia to Turkey, could show relevant climatic differences and drivers), with quite similar results.
2.2.5. Impact of heatwaves on wind power production and demand Anomalies of power consumption and wind production in HW days with respect to the whole summer are computed in two different ways: in percentage and normalized by the standard deviation. The percentage of anomaly is computed as the difference between the value in a HW day and the summer average, multiplied by 100. Normalized anomalies are calculated by subtracting the average of all summer days from the average in days of HWs. The anomaly values are then divided by the summer daily maximum temperature standard deviation (SD). Therefore, normalized anomalies (formally dimensionless) will be expressed in SD units, as already used in Bloomfield et al (2020) to evaluate the differences with respect to natural variability. Statistical differences between the mean of all the summer days and HW days are evaluated by means of a student t-test (p<0.05) from the stats package in R version 3.6.3 (2020-02-29).

Results and discussion
The effect of HWs and their spatial extension on the combined decrease of wind power and increase in power consumption is first investigated. Then, atmospheric patterns associated with HWs over the domain are studied, together with the impact of those events on wind power production and demand. Finally, the effect of the named 'mega-heatwaves' are studied as events with particularly high extension and magnitude. All the results are shown at the country level and for each isolated country.

Wind production and electricity demand in heat wave days
The key element of this study is how wind power behaves, in relation to electricity demand values, during the HW days. Thus, figure 3 displays the relationship between wind power and electricity demand anomalies (in percentage) for all summer days (blue points) and, specifically, in HW days (orange and purple points) for Portugal, Spain, Italy and Greece, the countries most populated and with larger wind power installed capacity (see figure 2) of Southern Europe. Most of the HW days are located on the upper-left part of the scatter plot, that is negative wind power and positive electricity demand anomalies in reference to the summer average. The anomalies of wind production in HW days (horizontal axis in figure 3) range from −30.8% to 6.9%, depending on the country. Besides, the averaged values on HW episodes indicate that electricity demand increases in the 45%-70% of the events, depending on the country, with an increase that represents from 3.5% to 10.6% with respect to the normal summer demand (vertical axis in figure 3). When the point cloud of HW days (orange and purple points) is compared with the rest of summer days (blue points), wind production and electricity demand averaged anomaly present a difference between these groups of days that is statistically significant, using a Student t-test of means. The case of Greece stands out, in which wind energy production increases on average on days of heat wave with respect to the summer average. This may be due to the presence of Etesian winds in this region during the summer (Tritakis 1982).
The spatial extension of an HW could be relevant for electricity demand and wind power production. Figure 4 shows the impact of HWs that affect 50% and 75% of the country's population (apart from the 30% used previously), with the aim to investigate the risk of energy shortfall events. Figure 4 displays that higher HW extension is generally related to slightly higher electricity demand. Lower wind production, from −9 to −15% in Spain, -28 to 45% in Italy and −2 to −7.5% in Greece, is obtained. In this sense, in a situation of high electricity demand due to more extensive HWs, wind power may be lower in these countries. In the case of Portugal, the effect of the extension is not very clear. It must be taken into account that the longer the HW is, the fewer days/ events there are, since they are more extreme and rare.
In this section, different aspects have been analysed. On the one hand, it has been seen that heatwaves and demand in Southern Europe are closely related. Although it was a somewhat expected result (Garrido-Perez et al 2021), it has not been presented in this general description so far, so it is interesting to describe it in detail as has been done here. The effect of heatwaves on demand depends on the duration and magnitude of the heat wave, since the greater the increase in temperature and its duration, the greater the need for cooling. Similarly, the extension of the heat wave seems to play a role as the more population and industries are affected, the greater the  demand. The projected increase in heatwaves in the coming years over the Mediterranean region (Molina et al 2020) adds relevance to this result. On the other hand, it has been seen that heatwaves produce a joint impact, increasing demand and decreasing wind energy production. The impact on wind energy production depends on the location of wind farms and heatwaves, so there are days of heatwaves in which there is no decrease in wind energy production. The implications that this compound effect may have for different countries will vary according to the current amount of wind power installed capacity and the importance of wind power in the energy mix. Thus, for example, in Spain and Portugal the risk of an energy deficit for the system will be greater than in Italy, since wind generation made up over 20% of total energy production in Spain and Portugal in 2022, whereas in Italy, it accounted for just 7%.

Summer weather regimes (WRs)
Atmospheric patterns for summer over the studied domain are analysed in this section in order to find the ones associated with high-impact HWs and analyse the wind resource and demand under these conditions. Figure 5 shows the average daily Z500 anomalies associated with the WRs for the 1989-2019 summer (JJA) period. Seven WRs explain 85% of the summer variance in the Euro-Mediterranean region, named as WR1 to WR7 from highest to lowest variance. The WR1 is characterized by anomalous high-pressure over Central Europe and lowpressure over the North Atlantic, while in the WR2 the low-pressure system is situated over Scandinavia and higher than normal pressures are seen in the Atlantic and Southwest of the domain. The WR3 is distinguished by a positive pressure anomaly over the Iberian Peninsula and lower pressure in the Northern region. Instead, in the fourth regime, WR4, a high-pressure system is situated over Italy and a low over the Atlantic area. The last three regimes are composed of less defined systems: WR5, is represented by two regions of anomalous low-pressure, Central Europe and the Atlantic area, and high-pressure in the rest of the domain. WR6 is characterized by a high-pressure anomaly over the Azores islands and the south Mediterranean area and low-pressure over Europe. And, finally, WR7 is distinguished by a high-pressure over the Iberian Peninsula and low-pressure over the Balkans. Contour dashed lines show the flow direction at 500 hPa height in each regime, which influences the weather systems and, consequently, the near-surface wind speed and temperature (Grams et al 2017).
When the focus is set on HW days (defined considering an extension larger than 30% of cells with population over at least one of the Southern European countries), WR7 presents the highest frequency (22.34%), being WR4 the lowest (5.31%). That is, on HW days, WR7 is the one with the highest anomalous frequency, followed by WR1 (20.14%), being WR4 the least frequent.
When considering the HW days for each country separately, the relative frequency of each WR varies (blue cells in table 1 indicate the highest frequency for each country) due to the differences among regions/countries. In this way, WR1 acquires more relevance for Italy, Croatia, Montenegro, Hungary, Serbia and Romania, with values that range between 28% and 40%. WR2, with percentages from 32% to 34%, obtains the highest frequencies in Greece, Bulgaria and Macedonia. In Portugal and Turkey, WR7 stands out with a 34% and 26% respectively, and WR3 in Spain with a 27%. Generally, the WR with the highest frequency in HW days for a country is related to the location of the high-pressure system. The exception is Turkey, probably due to the domain used in the WRs computation that is more centred on the western Mediterranean. Results are consistent with those obtained by Cassou et al (2005), just for the two European HWs of 2003 in the Euro-Atlantic region, where it was stated that HWs are more probable in the regime dominated by a negative anomaly, or lowpressure, over the North Atlantic Ocean and positive anomalies over the European continent.
More insight into the magnitude of electricity demand increase and wind power decrease for each country can be obtained by looking at the different WRs (table 1). Thus, in the seven WRs, electricity demand is greater than normal in all the Southern European countries, although with some intensity differences. Higher anomalies are found in some Balkan countries in WR4 (with a magnitude between 1.5 and 2 SD), the WR less frequent (as previously shown in figure 5). HW duration and magnitude could play a role in the distribution of demand anomalies related to WRs (Lee et al 2020), which is examined in section 3.3. These results are in line with what was shown in previous works, where it is shown that winter WRs are closely related to temperature patterns and could have an impact on electricity demand (van der Wiel et al 2019a), as extreme heat conditions in summer increase demand for cooling needs -as shown before in figure 3.
When looking at wind production anomalies (see table 1), a decrease in all counties for most of the WRs is obtained, except in GR and SR. In general, the wind power anomalies decrease up to -0.3 SD, although increase more than 0.1 SD in Spain, Portugal, Italy and Serbia in WR1 or WR3. A generalized decrease in wind production is seen in WR4, WR5, WR6 and WR7 in most of the countries with anomalies up to -0.42 SD. While in winter wind generation in the Mediterranean area seems to be clearly associated with some WR (Grams et al 2017), in summer some risk patterns (atmospheric situations that produce larger anomalies in demand and wind production) are detected in which the magnitude of the impact depends on the area. This is the case of WR1 in GR, with an electricity demand increase of 0.93 SD and a wind production decrease of -0.13 SD in HW days, or WR5 in HR, with an anomaly of 0.83 and -0.32 SD in demand and production, respectively. In general, the WR4 supposes Table 1. Percentage of heat wave days in a given WR (Freq.), electricity demand anomalies in heat wave days from ERA5 C3S model for the different WRs (Demand, in SD units of each country's summer anomaly time series) and wind power production in heat wave days from ERA5 reanalysis data (Wind prod. in SD units of each country's summer anomaly time series) by country: Portugal (PT), Spain (SP), Italy (IT), Croatia (CR), Montenegro (MO), Greece (GR), Hungary (HU), Serbia (SR), Macedonia (MD), Bulgaria (BG), Romania (RO), Turkey (TU). Blue cells represent the WRs with the highest frequency on heat wave days. a risk pattern in most countries, being the WR with the highest composite anomaly (positive electricity demand and negative wind production). From these results, it can be extracted that summer variability in the short term, determined here by means of weather regimes, impacts both wind production and electricity demand concurrently (van der Wiel et al 2019a, Bloomfield et al 2020, Jerez et al 2023. In this sense, weather regimes can be used to forecast extreme situations, such as the ones produced by HWs Garrido-Perez et al (2021).

Case study: extreme heatwaves
A clear correlation between HW events and the energy production and demand over the Mediterranean countries has been obtained. A natural and relevant question arises then: would the recent and socially relevant HWs over Southern Europe present an even more robust behaviour related to demand and wind power statistics?.
The Z500 anomalies during these events, represented in figure 6, show that extreme HWs are related to three atmospheric patterns. The first one, presented in the June 2001, August 2003 and June 2017 extreme HWs, is dominated by a positive Z500 anomaly over the east Atlantic-west European region, in agreement with Sánchez-Benítez et al (2018) and Sánchez-Benítez et al (2020) for the mega-heatwaves over the Iberian Peninsula. The effect over electricity demand (figure 6, second column) and wind production (figure 6, third column) seems to be different for the two variables in the 2001 and 2003 cases: lower (higher) than normal production (between 0 and -0.5 SD) and higher (lower) demand in the Western (Eastern) countries of the domain, according to the location of the high-pressure system. It is also seen that the degree of anomaly on the energy variables is related to the Z500 anomaly. In the event of 2017, wind production decreased in all countries, although the HW was situated over Iberia. A second pattern is distinguished by a positive Z500 anomaly dipole over the Mediterranean (similar to WR1) in the August 2012 and the July 2015 events. A generalized increase of wind power (between 0 and 0.25 SD) in the 2012 event and decrease (between 0 and -0.5 SD) in the 2015 event is produced. The electricity demand increases in most of the countries in both HWs, between 0 and 1.5 SD. The third pattern presents a dipole with positive (negative) Z500 anomalies over eastern (western) Europe. In the HW of 2019 over southeastern France and northeastern Iberia, the anomalies in wind production vary depending on the country, from -1 to 0.25 SD, and the power consumption decreases in Iberia and Bulgaria.
Looking at purple points in figure 3, the anomalies in mega-heatwave days range from 5% to 14.5% for electricity demand and from -11% to -51.7% for wind power production, with respect to the summer average anomalies. These values are higher than those obtained for the ensemble of HWs. From these results can be concluded that extreme HWs produce a decrease in wind power production and an increase in power consumption above the normal summer and HW values. Thus, the effect on wind power is clear for the more extensive, intense and persistent HWs.
When only the most extreme heat wave days are considered, the frequency of occurrence of the summer WRs changes. Thereby, the 27.61% of days fall in WR1, the one with the larger variance explained, followed by WR2 (25.37%) and WR3 (21.64%). Any of the HWs studied occur in WR4, and WR5 (3.73%) and WR7 (7.46%) are very rare.

Conclusions
This paper analyses summer electricity demand, wind power production and heatwaves combined relationships over each Southern European country. Although some of these features have been previously separately studied, the main aspects of novelty are its multidisciplinary focus, the country scale analysis when using demand, production and climatic features (distinguishing among summer weather regimes (WRs)), and the inclusion of spatial size of heatwaves (HWs that affect more than the 30 per cent of the country and the 60th percentile of the population density) to measure their impact. It must be pointed also that most of the demand vs renewable production studies have been focused on the Northern European countries during wintertime, where it is clear that demand peaks due to heating, but here air conditioning plays a similar role, and it is expected to be increased due to climate change conditions, especially over this hotspot region, as indicated by IPCC reports (Pörtner et al 2022).
Since the annual wind speed is lower in summer than in winter and HWs are extreme weather events that produce an increase in power consumption in the Southern European countries, the combined occurrence of both events could lead to energy shortfalls. Therefore, the impact of HWs in modelled electricity demand data and wind production is analysed at the country level and for each of the main summer WRs.
In general, wind power production decreases while electricity demand increases in all countries on days of HW. In addition, a greater extension of the HW is related to slightly higher demand. The relation of HW extension with wind production is not as clear as it is in power demand values. The larger the HW extension is, the lower the wind production seems to be obtained. Complexities come from the location of wind farms, the characteristics of the atmospheric patterns that produce an HW, or even the definition of HW employed. However, the results are clearer in the most extensive, intense and persistent HW events, in which an increase in demand and a decrease in wind power are obtained compared to all summer values and/or the whole amount of HW days.
In a general picture, HWs in Southern Europe are more frequent when atmospheric conditions present a negative Z500 anomaly over the Atlantic Ocean and positive anomalies over the European continent. For each country, the results show that there are some risky patterns in which the electricity demand increases at the same time that wind production decreases under HW conditions. A better knowledge of these atmospheric patterns that produce an HW and their relationship to electricity demand and renewable energy can help to forecast these extreme events in advance to alert the population and prepare for the possible consequences, such as the increase in energy demand that, if very prolonged, can cause supply problems in the population.
In this study, it has been seen that high-impact HWs produce multiple impacts on the electrical system: an increase in demand and a decrease in wind power production. This combination would amplify the impact on society (a shortfall and/or an increase in the price of energy) and, therefore, if higher demand is assumed to be the sole driver of the energy deficit, the associated risk estimates could be underestimated. Although it seems relatively obvious that higher energy demand and lower wind energy production are observed during heatwaves, this relation is not direct for all cases. These results over the Mediterranean basin during the summer have not been shown explicitly in previous studies, since most focus on Northern Europe, where higher temperatures reduce the demand for electricity. Here, an overview of the entire basin is given, gathering information on climate and demand on multi-year scales. This analysis could be the first step in a composite analysis based on deeper approaches, both climatic (low wind and high temperatures) and energy (high demand and low production). Future research could include the usage of observed real data, and analyse if the decrease in wind power could be compensated with more solar energy in HW conditions. For this purpose, the availability of energy databases with more spatial detail than the country level would be of great importance. Other elements for further research based on the analysis presented here would be how to define a HW and its effect on the energy sector, through population, temperature and extension thresholds. And also, the role of climate change in a context with more renewables in the energy mix, as heatwaves are going to increase.