The yield of solar panels is not constant across the country. Where in the Netherlands is the yield the highest?
The efficiency of solar panels is, for a major part, determined by the number of hours of sunshine. This number is not the same everywhere. But it is also relevant at what hour of the day and what part of the year the sun shines. These two determine the power of solar irradiation and thus the amount of generated energy.
In this article, a calculation is presented to determine what is the best place to live in the Netherlands. If the efficiency of your solar panels is the only criterion. It is probably not, but it is still fun to do the calculations.
We need to calculate the solar panel power generation at different locations in the country. We could use a bounding box around the country and generate a grid of locations. This method will add many locations in the sea, in Germany and Belgium. Since we are only interested in the Netherlands, I will use a list of all places in the country and use this as the basis for the calculation.
The national CBS (Dutch bureau for statistics) can obtain a list of all places. All data available at the CBS can be downloaded. To ease this download, a Python package is available called cbsodata. Searching the CBS website (statline), we find all places in the dataset with the ID,
Obtaining the table as a dataframe is simple with the right tools:
Line 5 downloads the table from the CBS and converts it to a Pandas Dataframe (the method returns the data in JSON format). We are only interested in the place names which are in the columns
Naam_2 so we only keep these two columns and combine them into one (lines 6 -7) in the data frame
Now that we have all places in the country, we need to geocode them to latitude and longitude. This can be done with the search API of OpenStreetMap, Nominatim. This is a debug interface to the search engine of OSM. From a previous project, I already had the code to geo-code a <street, city, country> tuple, so a simple wrapper around this function that only requires a city name is sufficient:
get_lat_long_city method returns the lat, lon location of the place as two separate values. Line 29 uses the
map function of the dataframe to call the
get_lat_long_city method with the
name column as a parameter. With the
zip function, these are inserted into two new columns. In case there are duplicate names for the same location, duplicate geolocations are dropped.
Determine solar panel performance
In my previous article, Solar panel power generation analysis, I described the usage of the pvlib library for solar panel calculations. For this analysis, we will calculate for all locations the generated power for a solar panel of 1 KW lying flat on the ground, oriented south. We use this configuration for all locations so we can compare the results.
The dataframe is extended with the generated power as follows:
obtain_panel_power_data is the same as in the previous article. The
obtain_power_for_location is a wrapper that only requires the geolocation and defaults to the mentioned solar panel (flat surfaced). Line 25 calls this method for every row and stores the result in a new column ‘
P’. The generated power of one year (2020) is used.
Plot the results
So now we have geolocations and the generated power over a year. The final step is to plot this on a map. Folium makes it easy to plot maps in Python. We will plot all locations with a color scale that indicates the generated energy. To convert the generated energy to a color scale, we need to normalize it to the range [0,1] (lines 6–7). This can be mapped to a color scale by matplotlib. We will use a yellow-to-red scale for this purpose (lines 10–14).
When the geolocations and colors are calculated, they can be plotted onto a map (lines 20–24):
Mapping the range to the color scale results in a quadruple value that needs to be converted to RGB (line 13). Since the fourth value is the alpha channel, we do not need it for the plot.
This code results in the following plot:
The highest efficiency in Zeeland (Zoutelande); the lowest in Drenthe. (Aa en Hunze). The difference is 20%. A lot more than I expected.
At the beginning of this article, it was already mentioned that the amount of sunshine is a key factor. So is this the same map as the map of sun hours per year?
High over these maps are roughly equal, but especially in the north, differences are notable. The amount of sun hours is higher than in the east, but the generated power is lower.
Your solar panels will love you when you move to the southwest. Probably due to the sea wind, the sun shines more around the coastline. But probably this will not influence where you move.
The goal of the article is to demonstrate that a few handy packages and APIs (cbsodata, OSM, pvlib, and folium) make it very easy to gain insights into geographical data. The goal is to inspire you to make your own insights.
I hope you enjoyed this article. For more inspiration, check some of my other articles:
Disclaimer: The views and opinions included in this article belong only to the author.