Wednesday, 26 June 2013

Animated Bristol Weather

This is a png sprite animated with javascript. It shows the weather for Bristol recorded at Bristol airport fed through Wunderground, let me know if you'd like to use it for your location and I'll adapt the code.

Use this code to embed Bristol Weather into your website
<iframe style="border:0" src="" seamless width="400" height="320" scrolling="no"> </iframe>

Wunderground has a list of icons to cover all the different weather conditions across the world. I have been recording the wunderground weather feed since February and in four months these are the only condition codes used to describe all the different weather we've had in that time. Which has been freezing and really sunny at time. I think someone needs to re-evaluate the condition codes for weather and increase the vocabulary.

1 tstorms
31 snow
60 cloudy
78 fog
106 hazy
338 rain
764 clear
848 mostlycloudy
971 partlycloudy

A cron job reads the weather off a wunderground feed once an hour and stores the data in a local database. This is to cut down on the amount of calls to wunderground and also keeps our record of weather. I've only made seven animations as it's pretty much just cloudy.