Category Archives: Linux

Python Script to Update Icecast Metadata With METAR and TAF Data

Python Script to Update Icecast Aviation Audio Feeds with METAR and TAF Data

 

Here are two scripts to retrieve airport METAR and TAF data from the National Weather Service website and then send this data to an Icecast server to update stream metadata.

You can get the scripts here (use wget from a Linux command line):

http://www.k7bbr.net/files/imetarkslcExample.py
http://www.k7bbr.net/files/itafkslcExample.py

Save them with whatever names you’d like (probably imetar[AirportName].py). In each script enter the server/stream information and modify the script to download your desired station name. Then run a cron job every hour (or whatever interval you choose) to update your stream metadata with the airport METAR and TAF data.

Bash Script to Download TAF Data From NWS

Linux Bash Script to Download TAF Data from the NWS to Display in the Console

 

Usage:
taf [ICAO STATION ID]
Example: $taf kslc

Save the following in a file called taf:

#!/bin/bash
station=$(echo "$1" | tr '[:lower:]' '[:upper:]')
wget -q -O /home/$USER/taftmp http://weather.noaa.gov/pub/data/forecasts/taf/stations/$station.TXT
echo " "
more /home/$USER/taftmp
echo " "
rm /home/$USER/taftmp