How to capture and post NOAA Weather
On my weather site I have a NOAA Weather Radio (NWR) player that works in conjunction with Weather USA to offer the audio of NWR Station KEC61 in Mobile, AL via the web. This means I have a home computer that is receiving the station and continuously uploading the audio to their Icecast server. Being in a coastal area, along with the normal weather alerts we also receive a lot of marine warnings. For a long time I had envisioned capturing these voice alerts and making them available for mariners and others to listen to later in the event that they missed the original broadcast. This page outlines the project and offers some sample code.
(1.) The first thing you need is a receiver for the off-air NWR radio station. In my case I am using a Software Defined Radio dongle but any receiver capable of tuning the NWR station and feeding it into your computer sound card will work. A strong, clear signal is preferred.
(2.) The next thing you need is software to decode the digital alerts sent out over NWR. I found a program called SeaTTY from DXsoft. Basically you feed the NWR audio stream to SeaTTY and it monitors it for the digital signature of an NWR-SAME alert message. When it detects one it saves a .TXT file that contains the alert type, and SAME codes for the counties the alert covers. The filename is the time the alert was issued. 230719-143053.TXT would be a typical filename as year, month, day, hyphen, hour, minutes, seconds. All with leading zeros and time in 24 hour format. SeaTTY also saves a matching WAV file by the same name that contains the captured audio. A note here: SeaTTY is shareware. You can test it out for free but in order to save your settings you will eventually need to register. I encourage you to do so in the event that you go on to use it!
(3.) Now you need a way to upload the files to your web
server. I used the popular
WinSCP SFTP client and FTP client for Microsoft Windows. This
software has some great automation features using its own scripting engine.
I setup a Windows task to execute every 5 minutes and run a batch file that
deletes old files, then instructs WinSCP to synchronize a web server folder
with the corresponding local folder. This automatically keeps the
local and web server files in sync and cleans up the older alerts from both
locations. That batch file is as follows;
Note that the batch file runs a WinSCP script named
upload_script.txt that I placed in the C:\ProgramData\SeaTTY\ folder.
That script file appears below:
(4.) Now that you have SeaTTY capturing alerts and WinSCP
posting them to your web server, you will need a way to display them on your
page. I have written a PHP script that does that job. I named
it: NOAA_radio_js.php. You call
NOTES: This script contains county and marine SAME codes that are associated with NWR station KEC61 in Mobile, AL. It will work for all NWR stations but unless the county code is contained in the $county_array Array the program will just print the code number and not the text name. The user will need to modify the $county_array for the area covered by the station they are monitoring. You can find a list of the counties covered by your NWR station here: https://www.weather.gov/dsb/sites?site=KEC61 and you find marine codes here: https://www.weather.gov/nwr/counties The $code_array Array is the generic 3 letter NOAA alert codes and textual names. It should be fine as is unless NOAA decides to add some new ones.
|If you find this code of value, donate a little to the cause. Think of the time you just saved!|
|USE AT YOUR OWN RISK!|
Questions / Comments? Email me.