NCL Scripts to Download MODIS Data


MODIS products can be downloaded free of charge from “Land Processes Distributed Active Archive Center (LP DAAC)”, (click here).

There are different products available, with various spatial and temporal resolutions. Some are daily basis, while the others are available on a 8 days or 16 days basis. The pixel size also varies.

There are various methods that you can download these products. However, if you are performing some time series analysis, and interested to download, let say, 10 years of data, you might need a more automated method to download these data sets.

If you know your way around linux (or Mac), you can simply pull whole lot of data from their ftp server using wget command. There are also scripts in R which let you to automate the download and making the mosaic using MRT (click here or here).

A while back I needed to perform similar task. Therefore, I developed some NCL scripts to automate the download procedure. While coding those scripts, I tried to be as general as possible. The base download routine in NCL is

DownloadMODBase( nv [1]:integer,
nh[1]:integer,
syyyy[1]:integer,
smm[1]:integer,
sdd[1]:integer,
eyyyy[1]:integer,
emm[1]:integer,
edd[1]:integer,
StoreDir[1]:string,
ProductName[1]:string,
ftpDir[1]:string)

where:

  • nv is the vertical tile number,
  • nh is the horizontal tile Number
  • syyyy, smm, and sdd defines the starting date of the interval you are interested to download,
  • eyyyy, emm, and edd defines the ending date of the interval,
  • StoreDir defines the location you want the file to be stored,
  • Product Name is the name of the product you want to download (a folder using this name is created in the location defined by StoreDir,
  • and finally, ftpDir is the ftp address of the server that you want to download the data from.

You can find the ftp address from the LP DAAC website; however, I do admit that things can get even easier. Particularly the part that you need to provide ftp address. So, I created some more NCL procedures for the product that I needed to download. These functions already have the ftp address; therefore, you do not need to provide the ftp address. The NCL procedures are called “DownloadXXXX”, where XXXX defines the MODIS product. The interface is the same as DownloadMODBase, except that you do not need to provide product name and ftp address. Current possible values for XXXX are:

  • MCD12Q1
  • MCD15A2
  • MCD43B3
  • MOD11A1
  • MOD12Q1
  • MOD13A2

Well, these were the product that I needed. Feel free to add more product name. Send me the code snippet and I will include it in the NCL script.

NOTE: You need to have wget installed. It is easy:

  • debian base linux: sudo apt-get install wget
  • RedHat base linux: sudo yum install wget (I think it should be like this, never tried it myself)
  • MAC: sudo port install wget
  • Windows: Sorry Folks, generally you are on your own. But on Cygwin, launch the installer and search for wget package. It will install it for you. I did it once, it was easy and surprisingly nothing crashed. ( I think they missed to put the crash code in there ).


Where to download the Scripts?

Now the most important question, i.e. where to download these scripts! I have uploaded the files on http://www.4shared.com. Just click here to access the file. And remember, it is free to download these files.

Advertisements
This entry was posted in Script, Tech Tips. Bookmark the permalink.

One Response to NCL Scripts to Download MODIS Data

  1. Theo says:

    can you modify it so that it works now that FTP is closed?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s