MODIS (version 1.2.2)

runGdal: Process MODIS HDF with GDAL

Description

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

Usage

runGdal(
  product,
  collection = NULL,
  begin = NULL,
  end = NULL,
  extent,
  tileH,
  tileV,
  SDSstring = NULL,
  job = NULL,
  checkIntegrity = TRUE,
  forceDownload = TRUE,
  overwrite = FALSE,
  maskValue = NULL,
  ...
)

Arguments

product

character, see getProduct.

collection

character or integer, see getCollection.

begin, end

Date or character. Begin and end date of MODIS time series, see transDate.

extent

Extent information, defaults to 'global'. See getTile.

tileH, tileV

numeric or character. Horizontal and vertical tile number, see getTile.

SDSstring

character, see getSds.

job

character. Name of the current job for the creation of the output folder. If not specified, it is created in 'PRODUCT.COLLECTION_DATETIME'.

checkIntegrity

logical, see getHdf.

forceDownload

logical, see getHdf.

overwrite

logical, defaults to FALSE. Determines whether or not to overwrite existing SDS output files.

maskValue

Currently ignored.

...

Additional arguments passed to MODISoptions, e.g. 'wait'. Permanent settings for these arguments are temporarily overridden.

Value

A list of the same length as 'product'. Each product slot either holds a sub-list of processed dates which, for each time step, include the corresponding output files as character objects or, if no files could be found for the specified time period, a single NA.

Details

rll 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.

runGdal uses numerous MODIS functions under the hood, see the linked functions in 'Arguments' for details and inputs.

If extent is a Raster* object, the output has exactly the same extent, pixel size, and projection. If extent is a sp or sf object, the output has exactly the same extent and projection except for point geometries with length = 1 (ie. a single point) where only the projection is inherited. If tileH and tileV are used (instead of extent) to define the area of interest, and outProj and pixelSize are 'asIn', the result is only converted from multilayer-HDF to dataFormat, default "GeoTiff" (MODISoptions).

See Also

getHdf, runMrt.

Examples

Run this code
# NOT RUN {
# LST in Austria
runGdal( product="MOD11A1", extent="austria", begin="2010001", end="2010005", SDSstring="101")

# LST with interactive tile 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")

# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace