Skip to content

Instantly share code, notes, and snippets.

@kapadia
Created July 15, 2015 16:32
Show Gist options
  • Save kapadia/a414dca221c6c976d4c1 to your computer and use it in GitHub Desktop.
Save kapadia/a414dca221c6c976d4c1 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eou pipefail
function usage() {
echo ""
echo "Test USGS download limit."
echo ""
echo "Usage: ./test-usgs-download-limit.sh"
echo ""
}
function onerror() {
rm -f $tmpfile
usage
exit 1
}
trap onerror EXIT
function test_download_limit() {
node=EE
dataset=LANDSAT_8
start_date=2015-07-14
end_date=2015-07-15
tmpfile=scene-ids.txt
usgs login $USGS_USERNAME $USGS_PASSWORD
usgs search --node $node $dataset --start-date $start_date --end-date $end_date --geojson \
| jq -r ".features[].properties.entityId" > $tmpfile
cat $tmpfile | parallel --gnu usgs download-url --node $node $dataset --product STANDARD {}
rm -f $tmpfile
}
test_download_limit
trap - EXIT
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment