MODISGrid: Create GIS ASCII files from downloaded MODIS data files

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/MODISGrid.R

Description

Looks for ASCII files of downloaded MODIS data in a directory and creates new ASCII raster grid files that allow data downloaded using MODISTools to connect to a GIS environment. The new raster grid files can be converted into raster images and loaded into a GIS environment where further data processing or spatial analysis can take place.

Usage

1
MODISGrid(Dir = ".", DirName = "MODIS_GRID", SubDir = TRUE, NoDataValues)

Arguments

Dir

Character; file path to the directory where downloaded ASCII files to be processed are located and the output is written: default Dir = "." extracts files from the working directory.

DirName

Character; the name of the directory (a subdirectory found in directory specified as Dir) where the new ASCII raster grids will be written. If the directory does not already exist, it will be written.

SubDir

Logical; if TRUE, all ASCII raster grids created from one MODIS data file will be collected under a subdirectory, within DirName, that has the same name as the MODIS data file from which it was created. If FALSE all ASCII raster grids will simply be written to DirName, with no nested file structure.

NoDataValues

Named list; the no data values for all the data bands contained in the files. Should be specified as a list of vectors: the names for the list elements should be the product codes and each element should contain a named vector of no data values for bands within that product. For guidance, see the example below. All data bands found in the MODIS data files should be listed in this argument. These values are neccessary to identify pixels with missing data. The correct no data values for the data bands of interest can be found at on the ORNL LPDAAC website.

Details

A raster grid file is created for each grid found in a MODIS data file (i.e. a new file is written for each date that occurs in a time series). In other words, where the MODIS data file may follow a tile of pixels over time, the raster grids split up each tile to create a new file for that tile at each new date. Therefore, multiple raster grids may be created from one MODIS data file. These files can be stored in one directory or nested in subdirectories for each MODIS data file, using the optional argument SubDir. By default, the subdirectories are created to retain the spatial structure.

The data are in the MODIS projection system. To combine a raster grid with a projection, the two files must be stored in the same directory with the same file name. Every raster grid needs a respective PRJ file. The projection (PRJ) file for each ASCII raster grid is included in the function output.

Value

Multiple ASCII raster grid files, with PRJ files, containing a tile of MODIS pixels at a given date, either all written to one directory or separated into subdirectories for each MODIS data file found. The file names for each raster grid created are composed of the following: "GRID_", the file name of the relevant MODIS data file, the data band that the grid pertains to, and finally the MODIS acquisition date for the grid (in Julian date format).

Author(s)

Sean Tuck

See Also

MODISSubsets MODISSummaries ExtractTile

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# dontrun() used because running the example requires internet access.

dat <- EndCoordinatesExample
names(dat) <- c("lat", "long", "start.date", "end.date", "ID")

MODISSubsets(dat, Products = "MOD13Q1", Size = c(1,1), StartDate = TRUE,
             Bands = c("250m_16_days_EVI", "250m_16_days_NDVI", "250m_16_days_pixel_reliability"))

MODISGrid(NoDataValues = list("MOD13Q1" = c("250m_16_days_EVI" = -3000,
                                            "250m_16_days_NDVI" = -3000,
                                            "250m_16_days_pixel_reliability" = -1)))
    
## End(Not run)

seantuck12/MODISTools documentation built on May 29, 2019, 4:55 p.m.