Learn R Programming

MODIS (version 1.2.11)

orgStruc: Reorganize MODIS Files in Local Data Archive

Description

Reorganize the storage structure of your MODIS archive according to the settings in options("MODIS_arcStructure"). Depending on the specified 'source', you can also use this function to gather all MODIS grid files on your machine and reorganize them. The main purpose is to organize the archive, but it is also possible to copy a subset of files to a desired location!

Usage

orgStruc(from, to, structure, pattern, move = FALSE, quiet = FALSE)

Value

If quiet = FALSE (default), information on how many files have been moved (or copied) and deleted is printed to the console.

Arguments

from

character. Local path to look for MODIS files, defaults to options("MODIS_localArcPath") (see MODISoptions()).

to

character. Target folder to move (or copy) MODIS files to, defaults to options("MODIS_localArcPath").

structure

character. Storage structure, defaults to options("MODIS_arcStructure") (see Examples).

pattern

Regular expression passed to list.files(). Insert a pattern if you want to extract specific files from your archive.

move

logical. If TRUE, files are moved and duplicated files are deleted. If FALSE (default), files are just copied and thus remain in the origin folder. Note that the copying process performs rather slowly when dealing with large files, e.g. 250-m "MOD13Q1".

quiet

logical, defaults to FALSE.

Author

Matteo Mattiuzzi

Examples

Run this code
if (FALSE) {
# MOVE all MODIS grid data to the directory and structure as defined in 
# options("MODIS_localArcPath", "MODIS_arcStructure")
orgStruc(move = TRUE)

# COPY all MOD13Q1 from 2001 to folder "MyFiles/MOD13Q1.collection/"
orgStruc(pattern="MOD13Q1.A2001*.",to="MyFiles",structure="PRODUCT.CCC")

# COPY all MOD13Q1 to folder "MyFiles/"
orgStruc(pattern="MOD13Q1.*.",to="MyFiles",structure="") 
}

Run the code above in your browser using DataLab