Jeff Rankin Product Designer

Projects / Weather Tools

A set of tools for NWS weather reporting and radar image compositing. These tools have been tested on Mac OS (with Homebrew or similar package manager for dependencies), Linux, and Cygwin. 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 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

A shell script that, given radar ID, animation time period, and a time value after which old images are deleted ("never" can also be specified), outputs a radar image using the most recent image available and an animation for a duration up to (and including) the most recent image. It uses wget to retrieve the image layers and ImageMagick to produce the composite image and animation. I run it as a cron job every 10 minutes as below:

5,15,25,35,45,55 * * * * cd ~/Documents/radar ; ./radar.sh ILN -.17 .17

Wed Jun 27 2018 Update The script now uses ImageMagick options that produce much smaller file sizes.

The radar image shown on this example page actually consists of 8 layers (topography at the bottom, legend at the top):

  1. Topography
  2. Radar
  3. County (and state borders)
  4. Rivers
  5. Highways
  6. Cities
  7. Warnings
  8. Legend

The layer file-naming convention as well as radar IDs are detailed at the NWS's Downloading RIDGE Radar Images page.

Questions & Suggestions

Email jeff@jeffrankin.net.

License

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

Creative Commons License