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.
- sub config_icons {
- my $path = '/home/jacoby/Pictures/weather_icons/' ;
- my %config ;
- $config{ 'Clear' } = $path . 'sunny.png' ;
- $config{ 'Partly Cloudy' } = $path . 'cloudy1.png' ;
- $config{ 'Mostly Cloudy' } = $path . 'cloudy3.png' ;
- $config{ 'Cloudy' } = $path . 'cloudy5.png' ;
- $config{ 'Overcast' } = $path . 'overcast.png' ;
- $config{ 'Haze' } = $path . 'fog.png' ;
- $config{ 'Fog' } = $path . 'fog.png' ;
- $config{ 'ELSE' } = $path . 'dunno.png' ;
- return \%config ;
- }
sub config_icons {
my $path = '/home/jacoby/Pictures/weather_icons/' ;
my %config ;
$config{ 'Clear' } = $path . 'sunny.png' ;
$config{ 'Partly Cloudy' } = $path . 'cloudy1.png' ;
$config{ 'Mostly Cloudy' } = $path . 'cloudy3.png' ;
$config{ 'Cloudy' } = $path . 'cloudy5.png' ;
$config{ 'Overcast' } = $path . 'overcast.png' ;
$config{ 'Haze' } = $path . 'fog.png' ;
$config{ 'Fog' } = $path . 'fog.png' ;
$config{ 'ELSE' } = $path . 'dunno.png' ;
return \%config ;
}
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?
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.
ReplyDeleteOkay, that's probably not exactly what the GWeather API says.
ReplyDelete