Internets: Weather/Forecast Commands

The Internets Weather/Forecast commands use OpenWeatherMap for their weather data. In addition, weather and forecast support the ability to accept U.S. ZIP codes as input.

Accepting U.S. ZIP Codes

In PyPsd’s main directory, there’s a script. This will automagically connect to the database in your PyPsd config file, and import all of our ZIP codes (about 43k in total).

Script options:

  • --drop: Drop the ZIP codes currently in the database
  • --debug: Print each ZIP code that we import, mostly used for debugging

Example script output

Importing table:

$ ./
ZIP Table does not yet exist.
ZIP Table created.
Populating ZIP Table
1000 rows inserted
2000 rows inserted
3000 rows inserted
4000 rows inserted
41000 rows inserted
42000 rows inserted
43000 rows inserted
43204 rows inserted in total

Dropping table:

$ ./ --drop
Current ZIP table dropped.

Debug information:

$ ./ --debug
ZIP Table does not yet exist.
ZIP Table created.
Populating ZIP Table
Inserted ZIP code 00210 : -71.013202 : 43.005895
Inserted ZIP code 00211 : -71.013202 : 43.005895
Inserted ZIP code 00212 : -71.013202 : 43.005895
Inserted ZIP code 00213 : -71.013202 : 43.005895

Debug numbers represent:    ZIP Code : Latitude : Longitude


The ZIP code data itself is in data/weather-zipcodes.csv. This data is from the CivicSpace US ZIP Code Database, and licensed under the Creative Commons Attribution-ShareAlike license as specified in the readme file, data/weather-zipcodes.README.