When those summer storms or winter blizzards come rolling in, it can be handy to look at a weather radar to determine their direction and possible intensity. Not wanting to have another open tab on my web browser, I made the Weather Radar! as a permeant radar viewer for my desk!
Connected to Wifi, the Radar! downloads NWS radar images, overlays them on a map, and plays looping animations of the 1-hour precipitation layer. With OpenWeather data, the Radar! also shows current weather conditions and the forecast for the next few days.
A toggle switch and 5-way navigation switch allow switching between modes/pages, while a potentiometer acts as a zoom knob for the map.
The NWS has a new radar webpage that uses HTML5, an interactive map, and Open Geospatial Consortium (OGC) compliant layers. These layers are especially handy because they can provide us with radar images for a particular area via a simple URL request (using Web Map Service WMS or Web Feature Service WFS protocols).
The NWS helpfully provides a page of the OGC compliant layers they offer, including alerts, warnings, and layers for the 200+ weather radar stations… (which I apparently missed when I started working on this!).
For a given latitude and longitude in the USA, the Radar!:
- Obtains the nearest radar station ID (using the Weather API service)
- Uses the radar station ID (e.g. KJAX) to obtain metadata and times for previous radar layers (e.g. XML GetCapabilities document for the 1 hour precipitation layer for the radar station in Jacksonville).
- Generates a tiled base map using the GeoTiler library (using a given zoom level, map size, and map centre).
- Uses all of this information to make a WMS request and download the last 5 - 10 radar images.
- For each time frame, combines the base map, radar image, and other layers and annotations using the Pillow imaging library.
- Displays the combined image for each time frame, to make a looping animation.
- Uses the latitude and longitude to get OpenWeather data for some extra forecasting jazz.
The Weather Radar! is written in Python with Blinka support!
I'm slowly adding example code over on the Weather Radar! github page!
An Adafruit PCF8591 gives the Pi ADC support to read the analog voltage from a potentiometer mounted on front, while a toggle switch and a 5 way navigation switch connect to the Pi's GPIO pins.
The case is from an old analogue meter I found discarded in my shed 5 years ago. While the battery and electronics inside had mostly crumbled away into toxic dust, the case and screws were still ok! After a thorough clean and a bit of patching with some wood filler, I gave the case a nice coat of sky blue paint (… because you know… weather).
Inside, the Pi and PiTFT HAT attach to the remnants of the meter gauge housing using a mount I designed and 3D printed. A cheap magnifying lens enlarges the screen a little and gives it a slight retro look (especially when viewed from an angle!).