WxBot -- an APRS Weather Forecast Auto Responder

WxBot is an APRS-IS listener app that listens for messages and responds with a brief US National Weather Service forecast.  International users note, Metar, and CWOP are the only useful queries for locations outside of the United States.

Send an APRS message to WXBOT and receive back a weather forecast for your location. 

Optionally, you can specify "where" "when" and "what"

The "where" can take the following form:
  • Any US callsign
  • Any callsign[-ssid] or  object known to api.aprs.fi that has a location including AIS ships.
  • City,ST (NOTE: City,ST must be the first part of the message.  City and state must be separated by a comma. Spelling is based on the us.zip file at geonames.org.  US postal service abbreviations for states.)
  • 5 digit zipcode
  • CWOP station id (I.E. DW6273)
  • 4 or 6 character Maidenhead Grid. (cn81, or cn81uh)
  • lat/lon  Using decimal degrees I.E. 41.123/-122.1123
  • 4 character ICAO station (KJFK KSFO etc...) returns METAR report.
  • 3 character IATA station (SFO, LAX etc) returns METAR report.
If the resulting location is outside the coverage of the United States National Weather Service, an error message is returned.  When an ICAO station is given, the default "what" is changed to METAR.  (You can specify full, or brief along with the ICAO station to get a normal forecast instead of the METAR report.)

The "When" can be a day of the week, with an optional "night" to indicate the evening forecast.  Abbreviations for days of the week are recognized (wed  instead of Wednesday)
today   -- (default)
tonight
tomorrow [night]
Monday [night]
Tuesday [night]
Wednesday [night]
Thursday [night]
Friday [night]
Saturday [night]
Sunday [night]

The "What" can be:
    brief -- default.  Short forecast. Usually a single APRS Message.
    full  -- multi line more complete forecast.
    current -- Returns current conditions from the nearest NWS station.
    metar -- Returns the current conditions from the specified. ICAO station in METAR form.
            If an ICAO station is not specified, the nearest ICAO station to the given location is used.
    cwop -- Returns weather report from the CWOP station nearest to the given location.
            If no location was given, it assumes your location.
            If a callsign was given, it returns results from the CWOP station nearest to the location of the callsign
    info -- Returns name,address, license class from the FCC ULS for the given US callsign.
    help or ? -- Return a help message
    whois -- same as "info"
    who-is -- same as "info"

The brief forecast usually fits within a single APRS message.  The full forecast will be split among multiple APRS messages.  If there are any active weather hazards (such as winter weather warnings etc..) in the forecast zone, the hazard will be included with the forecast and may cause the brief forecast to flow into multiple messages.  The "current" conditions are taken from the nearest National Weather Service reporting station.  

Special "Outernet/OUTNET" flag.  For users with Outernet satellite receivers (https://outernet.is/), the reply can be copied to the global Outernet satellite feed by adding the word "outnet" to your query.   

Examples
Example forecast request messages sent to WXBOT

Any message less than 3 characters
    Returns a brief forecast for the current location of the sending station.

Any US callsign
    Returns a brief forecast for the city listed in the FCC ULS for the given callsign even if they don't use APRS.

Boston,MA Saturday full
    Returns  Saturday's full forecast near Boston, MA

bozeman,MT cwop
    Returns  the current conditions as reported by the nearest CWOP station to Bozeman,MT.

Sault Sainte Marie,MI 
    Returns a brief forecast for Sault Sainte Marie, MI.

Coeur D Alene,ID Tonight full
    Returns the full forecast for tonight in Couer d'Alene, Idaho.

Tomorrow 96067
    Returns  tomorrow's forecast for Mount Shasta, CA

Tonight
    Returns the forecast for tonight at my current location

Tuesday night full
    Returns the Tuesday night full forecast for the most recent location of the requesting station.

w1aw
    Returns the current forecast for the location of station W1AW

usna-1 Sunday
    Returns the forecast for the Army Navy football game on Sunday. (Assuming usna-1 is at the stadium)

CN81uh
    Returns the forecast for the center of maidenhead grid CN81uh

41.123/-121.334
    Returns the forecast for Lattitude 41.123N, Longitude 121.334W

current
    Returns the current conditions as reported by the nearest National Weather Service reporting station.

metar
    Returns the conditions at the nearest ICAO weather station in METAR form.

KSFO
    Returns the current conditions at San Francisco International Airport in METAR form.

SFO
    Returns the current conditions at San Francisco International Airport in METAR form.

KJFK brief
    Return a brief weather forecast for JFK International airport. (note: this is NOT a TAF forecast)

w1aw metar
    Returns a METAR report from the ICAO weather station nearest to station w1aw.

whois w1aw
    Returns name,address,call class from the FCC ULS.

cwop
    Returns the current conditions as reported by the nearest CWOP (Citizen's Weather Observer Program) station.

"CWOP Station ID" (i.e. DW6273)
    Returns the current conditions as reported by the specified CWOP station.

'CALLSIGN' cwop
    Returns the current conditions from the CWOP station nearest to 'CALLSIGN'.

outnet
    Outnet can be added to any query to cause the report to also appear on the Outernet satellite APRS feed.  

metar outnet
    Returns a metar report for the nearest ICAO station.  The report will also appear on the Outernet satellite aprs feed.  

International users, note: your query should include a location, or have previously sent at least 1 position report.  Otherwise, WxBot will not know where you are.  United States users, if you do not include a location in your query, and have not sent a position report, WxBot will use your address as listed in the FCC ULS database.

Messages are "Acked" if requested.  The program understands and uses "Reply Acks" if the originating station supports them.  If the originating station sends an unnumbered message, then the reply will be unnumbered.  However, the program DOES NOT attempt to resend un-acknowledged messages.  If you didn't get a forecast, send the request again.  

If the requested location is offshore, then the weather service provides a marine forecast which will likely flow onto two or more messages.

If more than one object exists with the same name (AIS ships can have the same name as APRS objects), the first object returned by api.aprs.fi will be used.  Currently there is no way to specify exactly which object.

Credits and Thanks
This program uses the aprs.fi api to collect the latitude and longitude of the requesting station.   Special thanks to Heikki Hannikainen for his wonderful website and the api to access the data.

CWOP weather is extracted from findu.com..  Thanks to Steve Dimse for all of your work.

The forecast data is extracted from the national weather service at: forecast.weather.gov.   

The zip code database is at http://download.geonames.org/export/zip/US

The FCC ULS data is courtesy of http://call.n0agi.com


Program revisions
As of version 1.1, the program is single threaded and can handle a single forecast request at a time.  It is running on a Raspberry Pi on a DSL internet so be gentle please.

Version .01 20151216  first version... not working.  It just responds with the current time.
Version 1.0 20160101 working except lat/lon
Version 1.1 20160112 add maidenhead grid location, fix lat/lon code
Version 1.2 20160119 add weather hazards (warnings, and watches)
version 1.3 20160222 be more picky with data returned from national weather service, it may not be json
version 1.4 20160224 add 3 second delay between sending packets to the same station.
version 1.5 20160225 recognize "current" and "now" for current conditions at nearest NWS station
version 1.6 20160225 recognize commonly misspelled words.
version 1.7 20160126 use call.n0agi.com to look up call signs that don't appear in api.aprs.fi, catch aprs-is errors
                       add ICAO stations and metar lookups
                       add info, whois, who-is to return FCC ULS data
version 1.8 20160128 recognize additional mis-spellings
                      error checking on METAR results, only load METAR reporting ICAO stations
                      recognize wxbot as an alias
version 1.9 20160129  add WXBOT alias, and periodic position beacon
                      fix bug returning previous forecast if current forecast is unavailable
version 1.10 20160201 change position report packet to indicate "message capable"
                      put the status after the position report
                      change status1
version 1.11 20160202 fix beacon1
version 1.12 20160202 add CWOP station list, and CWOP to "what"
version 1.13 20160204 recognize IATA (3 letter) airport codes in addition to ICAR codes
                       use findu.com wxnear.cgi to  identify nearext CWOP station
                       change symbol from WX to computer. Otherwise findu and aprs.fi expect a weather report
                       Recognize Amateur CWOP station id's (i.e. AXnnn)
version 1.14 20160205 fix glitch in nearest CWOP where the distance is 0, there is no direction
version 1.15 20160315 add help message in response to "help" or "?"
version 1.16 20160701 bump number of forecast messages
version 1.17 20160711 reply with a numbered message if the requesting station originated a numbered message
version 1.18 20160802 keep served count in file.  Updated when we send bulletins
version 1.19 20160802 recognize city,st as location.  use us.txt from geonames.org for zipcodes
version 1.20 20161010 delay 5 seconds between packets.
version 1.21 20161115 close and re-open the APRS-IS feed once per day (Thanks WA1GOV)
version 1.22 20161130 recognize OUTNET as an option, and add OUTNET and APOUT to path.
To Do:
  • cache lat/lon for callsign so we don't keep asking api.aprs.fi repeatedly for the same answer.
  • cache forecast results 
  • add TAF for ICAO stations
  • Limit Outernet traffic so we don't overwhelm the satellite feed.
If you wish to use the code yourself, you can download it below.  You will need to get us.txt from http://download.geonames.org/export/zip/US, and the ICAO stations at: https://www.aviationweather.gov/static/adds/metars/stations.txt

ċ
wxbot-1.22
(52k)
Martin Nile,
Nov 30, 2016, 4:50 PM
Comments