Thursday, August 6, 2015

uhoh!! Typhoon satellite images

Click here to see GIF of typhoon Soudelor.

I never cease to be amazed by how easy it is to do stuff in python.

But I often cheat and used ImageJ to manipulate images.

import urllib

months = [str(100+i)[1:] for i in range(1, 13)]
days =   [str(100+i)[1:] for i in range(1, 32)]
hours =  [str(100+i)[1:] for i in range(24)]
minutes = ["00", "30"]

url_start = "http://www.jma.go.jp/en/gms/imgs/"
url_middle = "/infrared/0/"
url_end = "-00.png"

quadrant = "4"  # NW = 1, SW = 2, NE = 3, SE = 4

# goodies at http://www.jma.go.jp/en/gms/
year = "2015"
month = months[7] # 8th month = August
for day in days[8:2:-1]:
    for hour in hours:
        for minute in minutes:
            time_stamp = year + month + day + hour + minute
            url = url_start + quadrant + url_middle + time_stamp +url_end
            filename = "infrared_Q" + quadrant + "_" + time_stamp +".png"
            urllib.urlretrieve(url, filename)
            print url
            print filename