Created
December 6, 2015 20:56
-
-
Save kjordahl/232632b4fadfc3502419 to your computer and use it in GitHub Desktop.
Get URL for a Landsat 8 scene on AWS
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
URL_TEMPLATE = 'http://landsat-pds.s3.amazonaws.com/L8/{path}/{row}/{id}/index.html' | |
def url_from_scene_id(id): | |
path = id[3:6] | |
row = id[6:9] | |
return URL_TEMPLATE.format(path=path, row=row, id=id) | |
if __name__ == '__main__': | |
import os | |
import sys | |
if len(sys.argv) < 2: | |
raise RuntimeError('Usage: l8scene2url.py [landsat8 scene id]') | |
else: | |
# OS X only | |
os.system('open {}'.format(url_from_scene_id(sys.argv[1]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment