Created
October 18, 2011 05:21
-
-
Save natronics/1294666 to your computer and use it in GitHub Desktop.
Get a MODIS image from every day of the year using one of NASA's predefined subsets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Get the MODIS image from every day of the year using one of NASA's predefined | |
# subsets | |
import urllib | |
import time | |
baseurl = 'http://rapidfire.sci.gsfc.nasa.gov/subsets/?subset=' | |
subset = 'USA1' # Pacific Northwest | |
resolution = '250m' # 250 meters per pixel | |
satellite = 'terra' # EOS AM-1 | |
year = '2010' | |
url = baseurl + subset | |
url = url + '.' + year + '%03d' # date code | |
url = url + '.' + satellite | |
url = url + '.' + resolution | |
url = url + '.jpg' | |
def getimage(day): | |
modis = url % day | |
fname = '250m/%04d.jpg' % day | |
# Get the image, write it to file fname | |
urllib.urlretrieve(modis, fname) | |
# Every Day | |
for i in range(1,365): | |
getimage(i) | |
# Show progress in output | |
print i | |
# Wait at least a minute between calls, be nice! | |
time.sleep(120) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment