Created
July 19, 2012 16:48
-
-
Save jgomezdans/3145223 to your computer and use it in GitHub Desktop.
Download MODIS data for a particular tile
This file contains hidden or 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
#!/bin/bash | |
# This command works on my laptop, maybe it's a bug? | |
# USAGE: ./grab_modis.sh productname tile year | |
# Where productname is the complete product name (including collection) | |
# ie MOD17A2.005, or MCD45A1.005 | |
# gist in https://gist.github.com/3145223 | |
usage(){ | |
echo "MODIS data grabber" | |
echo "By J Gómez-Dans, National Centre for Earth Observation & UCL" | |
echo "Usage: $0 <product_name> <tile> <year>" | |
echo " <product_name> Complete MODIS product name, incl." | |
echo " collection: MOD17A2.005" | |
echo " <tile> MODIS tile, eg. h17v05" | |
echo " <year> Year as in 2005" | |
exit 1 | |
} | |
# The following is a BASH-ism, I think... | |
[[ $# -eq 0 ]] && usage | |
PRODUCT=$1 | |
TILE=$2 | |
YEAR=$3 | |
case "$PRODUCT" in | |
*MOD* ) PLATFORM=MOLT;; | |
*MYD* ) PLATFORM=MOLA;; | |
*MCD* ) PLATFORM=MOTA;; | |
* ) echo "Error in product name...";; | |
esac | |
# echo wget -r -nv -nc -c -nd \ | |
# -I '${PLATFORM}/${PRODUCT}/${YEAR}.*' -A "*${TILE}*.hdf" ftp://e4ftl01.cr.usgs.gov/$PLATFORM/$PRODUCT/ | |
wget -r -nv -c -nd -nc \ | |
-I "${PLATFORM}/${PRODUCT}/${YEAR}.*" -A "*${TILE}*.hdf" ftp://e4ftl01.cr.usgs.gov/$PLATFORM/$PRODUCT/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i want to download modis data using wget. can i get a python code for that