runGdal: Process MODIS hdf with GDAL

Description Usage Arguments Details Methods Note Author(s) See Also Examples

View source: R/runGdal.R

Description

Downloads MODIS grid data from archive (FTP or local) and processes the files.

Usage

1
2
3
runGdal(product, collection=NULL, begin=NULL, end=NULL, extent=NULL, tileH=NULL, 
tileV=NULL, buffer=0, SDSstring=NULL, job=NULL, checkIntegrity=TRUE, wait=0.5,
quiet=FALSE,...)

Arguments

product

See: ?getProduct

collection

Default is to download most recent collection version. See: ?getCollection

begin

Default is from the beginning of data. See: ?transDate

end

Default is to the end of data. See: ?transDate

extent

Default is NULL for interactive selection. See: ?getTile and Details!

tileH

Numeric. Default is NULL for interactive selection. See: ?getTile

tileV

Numeric. Default is NULL for interactive selection. See: ?getTile

buffer

Numeric. Buffer [in units of the 'outProj'] around the specified extent. See: ?getTile

SDSstring

Default is extract all SDS (layers). See: ?getSds.

job

Character name. Name of the current job for the creation of the output folder. If not specified it is created: 'PRODUCT.COLLECTION_DATETIME'.

checkIntegrity

Default TRUE. Check if the file is 'healthy' (and download it again if not) before doing further processings with it. This consumes also a littel bit of time to do the check.

wait

Numeric. Time to wait to re-try a un-successful online connection (URL listenting or 'download.file()' process). Keep it small, max ~1 sec.

quiet

Logical, Default FALSE. Some progress informations.

...

See section 'Methods'.

Details

runGdal() uses a lot of 'MODIS'-package functions, see in section 'arguments' and 'methods' the respective '?function' for details and inputs.
If extent is a raster* object, the output has exactly the same extent, pixel size and projection as the used raster* object.
If extent is a spatial* object (ie polygon shapefile), the output has exactly the same extent and projection as the used spatial* object.
If tileH and tileV arguments are used (instead of extent) to define tha area of interest and outProj amd pixelSize are 'asIn' the result is only converted from multilayer-HDF to dataFormat, default "GeoTiff" (?MODISoptions()).

Methods

outProj CRS/ prj4 or EPSG code of output, any format supported by gdal see examples.
Default is 'asIn' (no warping). See ?MODISoptions.
pixelSize Numeric single value. Output pixel size in target reference system unit.
Default is 'asIn'. See ?MODISoptions.
resamplingType Character. Default is 'near', can be one of: 'bilinear', 'cubic', 'cubicspline', 'lanczos'.
See ?MODISoptions.
blockSize integer. Default NULL that means the stripe size is set by GDAL.
Basically it is the "-co BLOCKYSIZE=" parameter. See: http://www.gdal.org/frmt_gtiff.html
compression logical. Default is TRUE, compress data with the lossless LZW compression with "predictor=2".
See: http://www.gdal.org/frmt_gtiff.html
dataFormat Data output format, see getOption("MODIS_gdalOutDriver") column 'name'.
localArcPath Character. See ?MODISoptions. Local path to look for and/or to download MODIS files.
outDirPath Character. See ?MODISoptions. Root directory where to write job folder.

Note

You need to have a GDAL installed on your system!
http://www.gdal.org/gdal_utilities.html

On Unix-alkes install 'gdal-bin' (I.e. Ubuntu: 'sudo apt-get install gdal-bin')
On Windows you need to install GDAL through OSGeo4W (http://trac.osgeo.org/osgeo4w/) or FWTools (http://fwtools.maptools.org/) since the standard GDAL does not support HDF4 format

Author(s)

Matteo Mattiuzzi

See Also

getHdf, runMrt

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
31
## Not run: 
# LST in Austria
runGdal( product="MOD11A1", extent="austria", begin="2010001", end="2010005", SDSstring="101")

# LST with interactiv area selection
runGdal( product="MOD11A1", begin="2010001", end="2010005", SDSstring="101")

### outProj examples
# LST of Austria warped to UTM 34N (the three different possibilites to specify "outProj")
# to find am EPSG or prj4 you may use: prj <- make_EPSG() See  
runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
 SDSstring="101", outProj="EPSG:32634")
 
runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
 SDSstring="101", outProj="32634")
 
runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
 SDSstring="101", outProj="+proj=utm +zone=34 +ellps=WGS84 +datum=WGS84 +units=m +no_defs")

### resamplingType examples
runGdal( job="LSTaustria", product="MOD11A1", extent="Austria", begin="2010001", end="2010005",
 SDSstring="1", resamplingType="lanczos", outProj="32634", pixelSize=100)

### processing entire tiles and keeping Sinusoidal projection
# This corresponds to a format conversion (eos-hdf04 to Geotiff) and 
# layer extraction (multi-layer to single layer)
runGdal( job="LSTaustria", product="MOD11A1", tileH=18:19,tileV=4, begin="2010001", end="2010005",
 SDSstring="1", outProj="asIn")


## End(Not run)

MODIS documentation built on May 2, 2019, 6:09 p.m.

Related to runGdal in MODIS...