Skip to content

Instantly share code, notes, and snippets.

@kjordahl
Created December 6, 2015 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjordahl/232632b4fadfc3502419 to your computer and use it in GitHub Desktop.
Save kjordahl/232632b4fadfc3502419 to your computer and use it in GitHub Desktop.
Get URL for a Landsat 8 scene on AWS
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