This little piece of code will look up the latest satellite image of ionization over the north polar region, extract the pixels for the Seattle area and print out the color. If the color is other than black then there is a possibility of seeing the aurora borealis from Seattle.

Add smpt and make it a cron job and have it automaically send you an email when the possibility of an aurora is high.

code

import Image
from urllib2 import urlopen
from cStringIO import StringIO

SEATTLE = [(131, 317), (131, 318), (132, 317), (132, 318)]

def process_image(location):
    img = Image.open(StringIO(urlopen('http://www.sec.noaa.gov/pmap/gif/pmapN.gif').read())).convert("RGB")
    return [sum(c) // len(c) for c in zip(*[img.getpixel((x, y)) for x,y in location])]    

if __name__ == '__main__':
    rgb = process_image(SEATTLE)
    print rgb

comments on the code

AuroraOverSeattle (last edited 2008-03-04 08:33:19 by localhost)