Of course, you could also use more than these four icons, to make the forecast better if you want. The forecast icon is then shown together with an icon (arrow) that represents the current trend of the barometric pressure. I mapped these weather conditions to a set of four forecast icons (sun, cloud, rain and thunderstorm), to make it more simple.
It uses the current barometric pressure, the trend of the barometric pressure (over the last six hours) and the current month of the year as an input. The output of the Zambretti Forecaster is one of 26 different weather conditions.
RASPBERRY PI CLOCK AND WEATHER DISPLAY HOW TO
A more detailed description about the functionality of the Zambretti Forecaster and how to put it into code can be found here.īelow, you can find my Python implementation of the Zambretti Forecaster algorithm. The Zambretti Forecaster is a weather forecasting tool in the form of a circular slide rule that was introduced by the company Negretti and Zambra in 1920. If you want to try a different approach for a weather forecast than my simple weather forecast, based on the barometric pressure history, then you could use the so called Zambretti Forecaster. You can add personal names, logos, or any other data you can think of, your fantasy is the only limit. You can use the shown example to easily modify the overlay to match your personal needs. The code shown above gives you the following result. Of course, you can use any other set of icons that matches your personal taste. Below, you can see my prefered set of icons. The icons that I use are transparent png-images with a size of 40×40 pixels. Os.system("convert webcam.jpg \"%s\" -geometry +\"%s\"+\"%s\" -composite webcam.jpg" % (icon, xcoord, ycoord)) If '09d.png' in icon or '09n.png' in icon or '10d.png' in icon or '10n.png' in icon or '11d.png' in icon or '11n.png' in icon or '13d.png' in icon or '13n.png' in icon or '50d.png' in icon or '50n.png' in icon: If '03d.png' in icon or '03n.png' in icon: # Calculate the position for the weather icon # Add the weather data os.system("convert webcam.jpg -undercolor lightblue -pointsize 16 -fill blue -annotate +6+399 \"%s\" webcam.jpg" % finalstr) Os.system("convert webcam.jpg -sigmoidal-contrast 2,50% -modulate 100,112 -unsharp 2x0.5+0.5+0 webcam.jpg") Weatherstr = "Temperatur: " + temp + " ☌ - " + "Luftfeuchtigkeit: " + humi + " \% - " + "Luftdruck: " + press + " hPa" If you are using pictures of another size, you have to adapt the coordinates.
Please note that the initial coordinates for the text and the icons are based on the size of my sample picture (640×42 7).
This requires some kind of logic that is also included in the example below. Since the values can have differnet lengths and also can be negative, you have to take care of this, to always have the same spaces between the text and the icon. In my example, I also display the current weather conditions as an icon, just behind the text. In my follwing example, I will use data from OpenWeatherMap, but of course, you can also use data from your local sensors. This can easily be done by using the tool ImageMagick ( ). If you are using a webcam to monitor the weather conditions at your home, or any other place, you may also want to overlay the current date, time and weather data like temperatur, humidity and the barometric pressure for having a quick overview.