Custom Weather Radar Images

Dec 7, 2007

NWS base reflectivity for LWX If you know the slightest bit about weather and the geography of the area which you are observing, you can, in the short term, forecast more accurately than what a weather website provides. I often want to be able to bring a radar image up quickly and clicking around websites takes time. Sure I could bookmark the weather page directly, but this was an interesting exercise and will prove useful when I get an iPhone.

The National Weather Service doesn’t have a simple image of the weather on their radar page, rather, it is an image that is dynamically generated from a set of standard overlays using Javascript. This allows them to more efficiently distribute radar images, since the terrain and maps that are the background never change. The organization they use is well documented, making it easy to find the overlays for you local radar. In my case, I wanted the topographical map, counties and highways in the image. I found the URL for each of these components using the aforementioned documentation and grabbed the appropriate images with wget.


The only layer that will change will be the last one, the actual radar data, so in my script that is the only one that will be wgetd on subsequent runs. To build the image, I used the composite program that is part of the ImageMagick package:

composite -compose atop LWXN0R0.gif LWXTopoShort.jpg basereflectivity.jpg
composite -compose atop LWXHighwaysShort.gif basereflectivity.jpg basereflectivity.jpg
composite -compose atop LWXCountyShort.gif basereflectivity.jpg basereflectivity.jpg
composite -compose atop LWXN0RLegend0.gif basereflectivity.jpg basereflectivity.jpg

I want the counties, highways and legend to show up on top of the weather data which itself is pasted atop the topographical map. To achieve this, I first toss the radar data onto the topographical image creating a new image, base_reflectivity.jpg. Then, I add each of the other layers to the base_reflectivity.jpg image in sequence.