Configuring MODIS R

In The last step you should have built the MODIS package and made a zip file. If you have trouble doing that, you can just download my zip file from the drop box and let me know what trouble you had.

With the MODIS package built, you now have to install it. Within R  Studio, click on Packages in the window

click on “Install Packages” and a pop up dialogue will appear. From top selector choose install from “zip”. Then browse to the folder that has your Modis zip package. Install the package and load the library  library(MODIS)

The first thing you will be asked to do is to modify a file.  .MODIS_Opts.R  and you will be directed where to save it. This file contains your default parameters. There is one parameter that you should check.  GDALpath.

Here is what my file looks like: I have BOLDED the one line that you need to add setting the GDALpath before saving the file. Make that change and save the file to the location  provided. For me it was in Users/steve/Documents  which is my R Home.

Below this I will explain what is going on

# This file contains default values for the R package ‘MODIS’.
# version 0
#########################
# This file uses codified ‘placeholders’ for the creation of the local archive structure, or to define the path on an remote location. This ‘placeholders’ are than substituted from internal functions using the name of a EOS-file. Use ‘placeholders’ only for ‘arcStructure’!!! Don’t substitute the ‘placeholdes’ with a specific value.

# Placeholders are:
# PLATFORM = “Terra”,”Aqua”, “Combined”, “SRTM”, or “ENVISAT”
# PF1 = “MOLT”,”MOLA” or “MOTA”
# PF2 = “MOD”,MYD” or “MCD”
# YYYY = year (i.e. ‘2009’)
# DDD = doy of the year (i.e. ‘003’)
# DATE = YYYY.MM.DD (i.e. ‘2009.01.03’)
# SENSOR = the sensor name (i.e. ‘MODIS’)
# CCC = collection (if applicable) as 3 digits character (i.e. ‘005’)
# C = collection (if applicable) as numeric value (i.e. 5)
# PRODUCT = the product name (i.e. ‘MOD13Q1′)
# TIME = HHMM (MODIS Swath data style don’t use it for now)
# “/” = new subdirectory (i.e. PRODUCT/DATE)
# “.” = internal separator (i.e. PRODUCT.CCC)

# Example: The file ‘MOD13Q1.A2009017.h18v04.005.2009036150230.hdf’, the localArcPath<- ‘~/MODIS_ARC’ and arcStructure <-‘/SENSOR/PRODUCT.CCC/DATE’ on a UNIX system will generate the following structure: ‘/home/YOURUSER/MODIS_ARC/MODIS/MOD13Q1.005/2009.01.17/MOD13Q1.A2009017.h18v04.005.2009036150230.hdf’

# Once you have modyfied values in sec 1. use the function ‘orgStruc()’ to re-organise your archive

#########################
# 1.) Path and archive structure defaults:

# set path. All data will be stored below this directory. If it doesn’t exist it is created.
localArcPath <- ‘~/MODIS_ARC’ # Don’t forget to call the function ‘orgStruc()’ after changing here!!

# set path, default output location for GDAL, FWT, SSOAP, MRT processing results. If it doesn’t exist it is created.
outDirPath <- ‘~/MODIS_ARC/PROCESSED’

# define, local archive structure. USE ‘placeholdes’!!
arcStructure <- ‘/SENSOR/PRODUCT.CCC/DATE’ # Don’t forget to call the function ‘orgStruc()’ after changing here!!

#########################
# 2.) Processing defaults:

resamplingType <- ‘NN’
outProj <- ‘GEOGRAPHIC’

#########################
# Windows specific (run: “MODIS:::.checkTools()” for inputs)

# Example:
 
FWToolsPath <- “C:/OSGeo4W/bin”
#########################
# PLEASE DON’T MODIFY BELOW HERE, NOT IMPLEMENTED YET.
# Example ftpstring
# 3.) If you have a personal MODIS datapool within your LAN and you face problems in the creation of an additional ‘ftpstring’ please contact one of us.
# Use ‘placeholders’ only in ‘variablepath’
# Additional ‘placeholders':
# DATE1DATE2 period start/end (MERIS specific)
# REGION (MERIS specific) MERIS date is stores in regions

# ftpstring0 <- list(name=’sitename’,SENSOR=’sensorname’, basepath=’/base/path’,variablepath=’/variable/path/’,content=c(‘what data is awailable? ‘images’, ‘metadata’!

ftpstring1 <- list(name = “LPDAAC”, SENSOR = “MODIS”, basepath = “ftp://e4ftl01.cr.usgs.gov”, variablepath = “/PF1/PRODUCT.CCC/DATE/”, content = c(“images”, “metadata”))

ftpstring2 <- list(name = “LAADS”, SENSOR = “MODIS”, basepath = “ftp://ladsftp.nascom.nasa.gov/allData”, variablepath = “/C/PRODUCT/YYYY/DDD/”, content = “images”)

ftpstring3 <- list(name = “Culture-MERIS”, SENSOR = “MERIS”, basepath = “ftp://culturemeris:culturemeris@ionia2.esrin.esa.int”, variablepath = “/DATE1DATE2/REGION/”, content = “images”)

ftpstring4 <- list(name = “JRC.it”, SENSOR = “C-Band-RADAR”, basepath = “ftp://xftp.jrc.it/pub/srtmV4/tiff”, variablepath = NULL, content = “images”)

ftpstring5 <- list(name = “Telescience”, SENSOR = “C-Band-RADAR”, basepath = “http://hypersphere.telascience.org/elevation/cgiar_srtm_v4/tiff/zip&#8221;, variablepath = NULL, content = “images”)

ftpstring6 <- list(name = “CGIAR”, SENSOR = “C-Band-RADAR”, basepath = “http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff&#8221;, variablepath = NULL, content = “images”)

So, what is going on here.  This file will be used to make your  directory structure for storing your LOCAL MODIS FILES, and the OUTPUTS of any processing you do with MRT or GDAL. Having a controlled local archive of MODIS allows you to control your storage and to insure that you dont end up with duplicate files or files thrown all over the place. Also, the functions we use to interact with GDAL and MRT will know where to write results.  For Now, lets not muck about with changing where the files get put.

Add the line  for GDALpath and make sure it points to the location where your gdal installation is.

Then save the file to the location  indicated. Then close your R session and restart.

Next up checking your installation

  1. August 7, 2013 at 8:36 PM

    If you would like to increase your familiarity just keep visiting this web page and be updated with the newest
    gossip posted here.

  1. No trackbacks yet.

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

Follow

Get every new post delivered to your Inbox.

Join 38 other followers

%d bloggers like this: