GetMODIS: Get MODIS data and process to match geogrid

Description Usage Arguments Details Value See Also Examples

View source: R/RS_get.R

Description

GetMODIS downloads, mosaics, and resamples MODIS data to match input geogrid.

Usage

1
2
3
4
GetMODIS(extent, prodName, outDir, begin = NULL, end = NULL,
  collection = NULL, buffer = 0.04, SDSstring = NULL,
  exclList = NULL, resampList = NULL, quiet = FALSE,
  scriptPath = NULL)

Arguments

extent

The pathname to the geogrid file (i.e., geo_em.d01.nc) OR the path to a georeferenced TIF file of the domain OR the path to a shapefile of the desired extent OR a standard country name that can be identified in the mapdata package.

prodName

The MODIS product name to download/process. Run the MODIS package getProducts() for a complete list of supported products.

outDir

Directory name to store processed TIF files. This is the equivalent to the MODIS package's "job" name. This is a directory name only and NOT a full path. The directory will be created in the preset MODIS package outDirPath.

begin

Date string for the start date to download/process MODIS tiles. The date string should follow MODIS package convention (e.g., "2011.06.01").

end

Date string for the end date to download/process MODIS tiles. The date string should follow MODIS package convention (e.g., "2011.06.01").

collection

From MODIS::runGdal help: "Default is to download most recent collection version. See: ?getCollection"

buffer

From MODIS::runGdal help: "Numeric. Buffer [in units of the 'outProj'] around the specified extent. See: ?getTile" (DEFAULT=0.04, which seems to cover MODIS tile corners sufficiently)

SDSstring

From MODIS::runGdal help: "Default is extract all SDS (layers). See: ?getSds."

exclList

List pairing SDS name (e.g., "Lai_1km", "FparLai_QC") with values to exclude from interpolation (i.e., convert to "nodata"). For example, for the Lai_1km product, valid range is 0-100, values 249-255 are fill values, but only one value (255) is reported as _FillValue in the HDF metadata. The exclude list should specify value ranges to exclude, and should be in the form:

list("SDS name"="exclude range", ...)

where "exclude range" can be a single number (e.g., 254), "gt <somenumber>" to exclude all values over some threshold (e.g., "gt 100"), or "lt <somenumber>" to exclude all values less than some threshold (e.g., "lt 0").

resampList

List pairing SDS name (e.g., "Lai_1km", "FparLai_QC") with reasmpling method to use. GDAL possible options (depends on version): 'near', 'bilinear', 'cubic', 'cubicspline', 'lanczos', 'mode', 'average' (DEFAULT='near', unless otherwise specified in MODISoptions(resamplingType="<somemethod>")). The resampling list should be in the form:

list("SDS name"="method", ...)

where "method" is one of the GDAL methods listed above.

quiet

From MODIS::runGdal help: Logical, Default FALSE. Some progress informations.

scriptPath

OPTIONAL path to where gdal_calc.py script lives in case it is not in the same default path as gdal executables

Details

GetMODIS reads a geogrid file and parameters on MODIS product and data range and downloads MODIS tiles where they do not exist (using the R MODIS package), mosaics where necessary, clips, reprojects, and resamples (using nearest neighbor) to match the geogrid. Results in a set of TIF files per the MODIS package specifications.

Please see documentation on the R MODIS package for details on required installs and workspace setup. This tool builds off of the MODIS runGdal tool, so follows MODIS file directory structure (see MODISoptions). This tool requires a local GDAL installation in addition to the required R packages.

NOTE: This tool currently only works for geogrid files in Lambert Conformal Conic projection OR a GDAL-friendly georeferenced TIF file.

Value

Empty

See Also

Other MODIS: CalcStatsRS, ConvertRS2Stack, ConvertStack2NC, GapFillRS, InsertRS, SmoothStack

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## First, specify the target directories for the MODIS package.
## Not run: 
MODISoptions(localArcPath="/d1/WRF_Hydro/RS/MODIS_ARC", 
             outDirPath="/d1/WRF_Hydro/RS/MODIS_ARC/PROCESSED",
             stubbornness="low")

## Then, use GetMODIS to download the MODIS MOD15A2 (FPAR/LAI) product for 
## all tiles that overlap our Fourmile Creek domain (as specified by the 
## geo_em.d01.nc file), mosaic if multiple tiles, clip to the domain extent,
## and resample to the domain grid cells. The raw HDF files will be stored in
## /d1/WRF_Hydro/RS/MODIS_ARC/ and the final processed TIF files will be 
## stored in /d1/WRF_Hydro/RS/MODIS_ARC/PROCESSED/Fourmile_LAI/.

GetMODIS(extent="/d1/WRF_Hydro/Fourmile_fire/DOMAIN/geo_em.d01.nc", 
         prodName="MOD15A2", outDir="Fourmile_LAI", 
         begin="2011.01.01", end="2011.01.31",
         exclList=list("Fpar_1km"="gt 100", 
                       "Lai_1km"="gt 100", 
                       "FparLai_QC"="255", 
                       "FparExtra_QC"="255", 
                       "FparStdDev_1km"="gt 100", 
                       "LaiStdDev_1km"="gt 100"), 
         resampList=list("Fpar_1km"="bilinear", 
                       "Lai_1km"="bilinear", 
                       "FparLai_QC"="mode", 
                       "FparExtra_QC"="mode", 
                       "FparStdDev_1km"="bilinear", 
                       "LaiStdDev_1km"="bilinear"))

## End(Not run)

NCAR/rwrfhydro documentation built on Feb. 28, 2021, 12:47 p.m.