W is a python script that displays weather data for a given location and timeframe.

$ ./w.py houston today

* Houston, United States
*
* Thu 14 May 2015
* Mostly Cloudy, with a high of 29C and a low of 23C

Installation

Obtain the python script either with $ git clone https://github.com/prb2/weather.git or by downloading the archive and extracting to a directory. Navigate into the directory with the script and make it executable with $ chmod +x w.py. Then, the script can be run using the syntax seen below.

Python is the only dependency. If you already have it installed and the path is in your environment, the script can be run as show below. If that doesn't work, run the script explicitly with python: $ python w.py <city> <option>

Usage

$ ./w.py <city> <option> 

If <option> is not provided, the current weather is displayed. Otherwise, <option> can be specified as any of the following:

  • today displays today's weather
  • tomorrow displays tomorrow's weather
  • week displays a five day forecast
  • sun displays sunrise and sunset times
  • wind displays current wind conditions
  • Examples

    $ ./w.py houston
    * Houston, United States
    *
    * Currently 27C, Thunder
    
    $ ./w.py houston today
    * Houston, United States
    *
    * Thu 14 May 2015
    * Mostly Cloudy, with a high of 29C and a low of 23C
    
    $ ./w.py houston tomorrow
    * Houston, United States
    *
    * Fri 15 May 2015
    * PM Thunderstorms, with a high of 30C and a low of 23C
    
    $ ./w.py houston week
    * Houston, United States
    *
    * Thu 14 May 2015
    * Mostly Cloudy, with a high of 29C and a low of 23C
    * 
    * Fri 15 May 2015
    * PM Thunderstorms, with a high of 30C and a low of 23C
    * 
    * Sat 16 May 2015
    * PM Thunderstorms, with a high of 31C and a low of 24C
    * 
    * Sun 17 May 2015
    * Thunderstorms, with a high of 30C and a low of 24C
    * 
    * Mon 18 May 2015
    * AM Clouds/PM Sun, with a high of 31C and a low of 23C
    
    $ ./w.py houston sun
    * Houston, United States
    *
    * Sunrise: 6:27 am
    * Sunset:  8:04 pm
    
    $ ./w.py houston wind
    * Houston, United States
    *
    * ~ Wind ~
    * Chill:     27C
    * Direction: 170 degrees
    * Speed:     8.05 km/h