Skip to content

Instantly share code, notes, and snippets.

@dwtkns
Last active October 1, 2017 20:19
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dwtkns/befcb920af83d459a7c9 to your computer and use it in GitHub Desktop.
Save dwtkns/befcb920af83d459a7c9 to your computer and use it in GitHub Desktop.
A shell function to quickly grab the data for a given Landsat 8 tile ID from Google's servers
# This is a shell function to quickly grab the data for a given Landsat 8 tile ID from Google's servers
# For example:
# l8get LC81690352014169LGN00
# The echo at the end is to remind myself of the syntax for extracting bands 8, 4, 3, and 2. (Pansharp, Red, Green, Blue)
# On OSX this would go into your ~/.bash_profile file.
# Requires gsutil from https://developers.google.com/storage/docs/gsutil_install
# Most useful in conjunction with USGS' Earth Explorer: http://earthexplorer.usgs.gov/
function l8get() {
id="$1"
path=${id:3:3}
row=${id:6:3}
yr=${id:9:4}
gsutil cp gs://earthengine-public/landsat/L8/$path/$row/$id.tar.bz .
echo ""
echo "tar -jxvf *.tar.bz '*_B[4328].TIF'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment