Gets the forecast and current alerts from the NWS API
Find a file
2023-01-09 20:24:50 -06:00
.gitignore cache forecasts on filesystem 2022-12-01 13:52:42 -06:00
fscache.py gracefully handle keys with / 2023-01-09 20:24:50 -06:00
meteor.py parse cache-control max-age for caching 2023-01-09 20:21:10 -06:00
README.md gracefully handle keys with / 2023-01-09 20:24:50 -06:00

meteor.py

A simple script written in about 4 hours that gets the weather. wttr.in was giving somewhat inaccurate results and we found the National Weather Service API one day, so we figured that we ought as well spend a little bit of time and have some fun with it.

Usage

meteor.py lat lon

lat and lon are the latitude & longitude of a particular point in the United States (e.g. 38.57 -121.48 is within Sacramento, California)

TODO / Issues

  • Geocoding would make this a little more usable. NWS lists several potential services
  • Round decimals to 4 places ourselves to avoid errors
  • Use the /gridpoints/gridId/gridX,gridY endpoint to generate our own forecast with things like probabilityOfPrecipitation
  • Fancy output like wttr.in
  • Display the names of the zones (requires extra API calls - cacheable for a long duration, though)
  • Shorter alert descriptions (parameters.NWSheadline[0] instead of description)
  • Work around known issues in the NWS API:
    • retry when gridpoints 500s
    • reduce gridX and gridY by 1 for AFC (AER/ALU), AFG, AJK, BOX, CAE, DLH, FSD, HGX, HNX, LIX, LWX, MAF, MFR, MLB, MRX, MTR, PIH offices/gridIds

Reference

License

(c) 2022 Starfall. All rights reserved.

  • "It shall be permissible to make quotations from a work ... provided that their making is compatible with fair practice." - Berne Convention
  • Information wants to be free.
  • Be gay, do crimes.