Projects / Weather Tools

A set of tools for NWS weather reporting and radar image compositing and animation. These tools have been tested on Linux and Cygwin but should also work on MacOS (with Homebrew or a similar package manager for dependencies). These scripts utilize services provided by the United States NWS, and can therefore only report weather for locations within the United States.

NWS Plain-text Forecast

A shell script that, given latitude and longitude, produces a plain-text weather report from the NWS. It uses the Lynx web browser (Note: Lynx HTTPS support is required) in dump mode to retrieve the content as plain text. Some additional text processing is utilized to trim the top and bottom of the report.

./weather.sh 40.0395 -84.2033

NWS Radar Image Compositing

These latest versions feature improved animation rendering (at the expense of file size).

Bash Revision 25 - Fri November 11 2022 (radar.tar.gz, 4.1K)

PowerShell Revision 30 - Fri November 11 2022 (radar.zip, 4.4K)

Bash and PowerShell scripts that, given radar ID and number of minutes to depict, output a radar image using the most recent NWS image available and an animation of the specified duration. By default, radar images are retained in the archive directory. However, if delete is passed as the third argument, these images will be deleted. The script uses Lynx and Wget (Bash version) to retrieve the radar images and ImageMagick (Bash and PowerShell versions) to produce the composite images and animation. These scripts have been tested on Linux, Cygwin and Windows 10. Example usage:

./radar.sh ILN 64

In the above example, an animation depicting approximately one hour's radar activity will be produced for radar ID ILN. Archived images will be retained.

Basic Variables

These variables handle the processing of the image list from the NWS, the processing of the images themselves, etc. Of special note is the radar_bg variable. Normally, this would be a map of the appropriate area. However, as production of this asset is a currently a manual process, only a placeholder image is provided.

footer_len=1               # Number of lines in footer to cut off
image_freq=4               # How often radar images are updated by NWS
resize_amt='25%'           # Amount to shrink the images by
animate_dur=$2             # Duration (in minutes) to depict in animation
radar_bg='background.gif'  # Background image (e.g. map) to use
font_color='white'         # Font color to use for radar image date and time

Notes on the PowerShell Version

The PowerShell version doesn't use the footer_len variable. Due to the difficulty involved in getting the date and time label compared to the Bash version, the image filename (which contains date and time) is used for the image label.

Sample Output

Known Issues/Future Enhancements

License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Creative Commons License