Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2009/09/23

Desperately Seeking Google Weather API Vocabulary

I work in a sub-basement. From about 9am to about 5pm, I don't see the sun. Great amounts of change can happen in that time, and I hate coming up for air without knowing what's up. So, great amounts of my programming come from trying to keep track of conditions. I send the weather info to local printers. I have a twitter feed. I have gravitated to using XML::DOM and Google's Weather API to give me the information. It's not too detailed, it's fast, and if Google's down, the Internet is down.

I have since found notify-send (mentioned here) and have found a set of weather icons that I like. And I'm working on getting the notifications look good.

My problem is that I'm not seeing a one-to-one mapping between the condition strings I'm getting from Google and the file names I'm getting from the icon sets. Nor are the image names listed in the XML.

So, I created a simple mapping of Condition strings to icon names.
  1. sub config_icons {  
  2.     my $path = '/home/jacoby/Pictures/weather_icons/' ;  
  3.     my %config ;  
  4.     $config'Clear' }         = $path . 'sunny.png' ;  
  5.     $config'Partly Cloudy' } = $path . 'cloudy1.png' ;  
  6.     $config'Mostly Cloudy' } = $path . 'cloudy3.png' ;  
  7.     $config'Cloudy' }        = $path . 'cloudy5.png' ;  
  8.     $config'Overcast' }      = $path . 'overcast.png' ;  
  9.     $config'Haze' }          = $path . 'fog.png' ;  
  10.     $config'Fog' }           = $path . 'fog.png' ;  
  11.     $config'ELSE' }          = $path . 'dunno.png' ;  
  12.     return \%config ;  
  13.     }   
This is a list of weather conditions that were observable in the American Midwest in summer and early fall, 2009. This is not the whole list of weather conditions.

What I am looking for today are the other ones, so I can finish this code and maybe send it out to you. Any help?

2 comments:

  1. Rain (Light, Medium, Heavy, Acid), Snow (L/M/H), Wind, Frost, Hail, Sleet, Graupel, Freezing Rain, Storm (Thunder-, Ice-, Snow-, Dust-, Sand-, Tropical-), Tornado, Dust Devils, Hurricane, Virga, Ice Fog, Flood, Drought, Aurora, Volcanic Ash, Brimstone, Plague of Locusts, Total Protonic Reversal.

    ReplyDelete
  2. Okay, that's probably not exactly what the GWeather API says.

    ReplyDelete