Pages

Weather from the Linux Command Line with weather-util

Many times, especially if I am planning on walking or riding my bicycle to work or school, I need to check the weather and I need to check it quick. The quickest way for me to retrieve any data is usually from the command line.

I decided to try out two Linux command line weather utilities: weather and metar.

Both of these utilities require that the user find his ICAO Airport Code. In my case, I use KDNL. Both also retrieve information from NOAA.

Today, I will be focused on the weather utility. This command provides output nicely in a format using standard measurements, i.e. Fahrenheit and miles per hour. To get it, run the following from your Debian-based distribution:

$ sudo apt-get install weather-util

Here's how you run it:

$ weather -iKDNL
Current conditions at GA (KDNL)
Last updated May 07, 2010 - 06:53 AM EDT / 2010.05.07 1053 UTC
Temperature: 64.9 F (18.3 C)
Relative Humidity: 90%
Wind: from the SE (130 degrees) at 3 MPH (3 KT)
Weather: mist
Sky conditions: clear

To get the forecast, the user must also supply his city and state. I am not sure how this is supposed to work for international users.

$ weather -iKDNL -cAugusta -sGA -f
Current conditions at GA (KDNL)
Last updated May 07, 2010 - 07:53 AM EDT / 2010.05.07 1153 UTC
Temperature: 68.0 F (20.0 C)
Relative Humidity: 83%
Wind: Calm
Sky conditions: clear
City Forecast for Augusta, GA
Issued Friday morning - May 7, 2010
Friday... Sunny, high 92, 10% chance of precipitation.
Friday night... Low 68, 10% chance of precipitation.
Saturday... Partly cloudy, high 84, 20% chance of precipitation.
Saturday night... Low 55.
Sunday... High 74.

If you do not want to have to type all the extras every time, provide a .weatherrc file in the home directory. To find out more about it, type man weatherrc from the command line. Here's mine:

[default]
City = Augusta
Forecast = True
ID = KDNL
St = GA

Now all I have to do is just type weather from the command line.

2 comments:

  1. I stumbled across this blog from a google search, and I have to say: nice write-up of weather-util. I have been working on my own way to access weather from the command line. It's called wunderpy and I think you should check it out.
    -Erik

    ReplyDelete
  2. Thanks, Erik. I'll have to check your project out. I wish that there was already a weather module in the gdata python package. That would be nice.

    ReplyDelete