Skip to content

Instantly share code, notes, and snippets.

@jgomezdans
Created July 19, 2012 16:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jgomezdans/3145223 to your computer and use it in GitHub Desktop.
Save jgomezdans/3145223 to your computer and use it in GitHub Desktop.
Download MODIS data for a particular tile
#!/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/
@sharmeen1812
Copy link

i want to download modis data using wget. can i get a python code for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment