This R script works with MRT (MODIS Reprojection Tool), and its performance is unbelievable for land data.

The only problem is when you use Atmospheric data from Modis, like "MOD05_L2".

The problem comes from here:

Such HDF files (Atmospheric data), only can open with "ModisSwathTool", but this R script is written to use "ModisTool" which can not open such HDF files.

Anyone here has experience to solve this problem? For example, change the R code within the R script to support and work with "ModisSwathTool"?

I mean, anyone had such problem before? If yes, what he/she did to solve that?

Any comments and helps are welcome.

  • You can execute system() function to run MRTSwath. Check ModisDownload.R, all that you put as argument, ends in system(paste(MRTpath, '/resample -p ',getwd(),'/','tmp.prm', sep='')) or system(paste(MRTpath, '/mrtmosaic -i ', MRTpath, '/TmpMosaic.prm -s "',bands_subset,'" -o ',getwd(), '/',filename, sep="")). You can do this for MTRSwath, syntax is almost the same. – aldo_tapia Nov 26 '16 at 12:01

You would have to take a good hard look at the script to make sure the the code structure is appropriate for atmospheric MODIS data and that it is as simple as calling a different exe. Since this is a different data format, I highly doubt that it is as simple as calling a different processing program, but one can hope.

As far as calling the ModisSwathTool rather than MRT, you would only need to change the system calls, and associated syntax, throughout the code. It looks like the functions that call MRT are "reprojectHDF" and "mosaicHDF". There is a path variable "MRTpath" set in each function that defines the path to the ext and is passed to system().

An example of a system call to MRT, with associated program syntax, is:

e <- system(paste(MRTpath, '/mrtmosaic -i ', MRTpath, '/TmpMosaic.prm -s "',bands_subset,'" -o ',getwd(), '/',filename, sep=""))  
  • Thanks @Jeffrey Evans. The file of “mrtmosaic” is in the MRT's bin folder. I have installed “ModisSwathTool” too, but “mrtmosaic”, is not in ModisSwathTool's bin bolder. So, we can not call such file in the script. As you mentioned, it would not be as easy as replacing one or two name in the script. I am looking for a better way to work with MODIS data. – Jeoff Jun 8 '15 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.