Mon 17 June 2013

Filed under Blog

Tags python modis web

Recently, the USGS has closed their FTP download service for MODIS products, such as LAI, surface reflectance, etc. This is quite annoying, because I had a nice wget script that no longer works... So I decided to code a simple downloader in python that woud supersede my previous hacked together bash script with wget (you can still find it here.).

Update

An update to the software has taken place. The following new features have been added:

Skip downloaded files
The software is now able to detected already downloaded files and will only download if local and remote sizes are different
Proxy support
It is now possible to provide an HTTP proxy through the --proxy option.

You can fork the code on github, or download the lates version as a tarball or a zip file.

The script is quite simple to use: you just call it with the -h option and you get some help text

$ ./get_modis.py -h
Usage


SYNOPSIS

./get_modis.py [-h,--help] [--verbose, -v] [--platform=PLATFORM, -s PLATFORM]     [--product=PRODUCT, -p PRODUCT] [--tile=TILE, -t TILE] [--year=YEAR, -y YEAR]     [--output=DIR_OUT, -o DIR_OUT] [--begin=DOY_START, -b DOY_START] [--end=DOY_END, -e DOY_END]

DESCRIPTION

A program to download MODIS data from the USGS website using the HTTP
transport. This program is able to download daily, monthly, 8-daily, etc products
for a given year, it only requires the product names (including the collection number),
the year, the MODIS reference tile and additionally, where to save the data to, and
whether to verbose. The user may also select a temporal period in terms of days of year.

EXAMPLES

The following example downloads daily surface reflectance from the TERRA platform for
tile h17v04 for 2004, between DoY 153 and 243:

$ ./get_modis.py -v -p MOD09GA.005 -s MOLT -y 2004 -t h17v04 -o /tmp/ -b 153 -e 243

The script will also work with monthly or 8-daily composites. Here's how you
download the monthly MCD45A1 (burned area) product for the same period:

$./get_modis.py -v -p MCD45A1.005 -s MOTA -y 2004 -t h17v04 -o /tmp/ -b 153 -e 243


EXIT STATUS
    No exit status yet, can't be bothered.

AUTHOR

    J Gomez-Dans <j.gomez-dans@ucl.ac.uk>
    See also http://github.com/jgomezdans/get_modis/



Options

--help, -h              show this help message and exit
--verbose, -v           verbose output
--platform=PLATFORM, -s PLATFORM
                        Platfor type: MOLA, MOLT or MOTA
--prodcut=PRODUCT, -p PRODUCT
                        MODIS product name with collection tag at the end
                        (e.g. MOD09GA.005)
--tile=TILE, -t TILE    Required tile (h17v04, for example)
--year=YEAR, -y YEAR    Year of interest
--output=DIR_OUT, -o DIR_OUT
                        Output directory
--begin=DOY_START, -b DOY_START
                        Starting day of year (DoY)
--end=DOY_END, -e DOY_END
                        Ending day of year (DoY)

So, you can see on the above examples that it is actually quite easy to use, and apparently it works for daily and composited products. At some point, I'd like to build a tool that gets the relevant data from the swath archive, but that's for when I grow up...

Comment

EO & DA Ramblings © J Gomez-Dans Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome and Font Awesome More