Main function to generate specified ENVIREM layers.
If requested, this function will split input rasters into tiles, generate desired variables,
and reassemble the results.
For the distinction between this function and layerCreation
,
see Details
.
generateRasters(
var,
maindir,
prefix = "",
outputDir = "./",
rasterExt = ".tif",
nTiles = 1,
tempScale = 1,
precipScale = 1,
overwriteResults = TRUE,
outputFormat = "GTiff",
tempDir = "~/temp",
gdalinfoPath = NULL,
gdal_translatePath = NULL,
useCompression = TRUE
)
The requested set of rasterLayers will be written to outputDir
.
a vector of variable names to generate, see Details.
path to directory of input rasters
prefix to append to output filename
output directory.
the file extension of the input rasters
the number of tiles to split the rasters when tiling is requested, must be a perfect square
integer; scaling factor for the temperature data, see envirem for additional details.
integer; scaling factor for the precipitation data, see envirem for additional details.
logical, should existing rasters be overwritten
output format for rasters, see writeRaster
for options
temporary directory for raster tiles that will be created and then removed
path to gdalinfo binary, leave as NULL
if it is in the default search path.
path to gdal_translate binary, leave as NULL
if it is in the default search path.
logical; should compression options be used to achieve smaller file sizes. Only pertains to format GTiff.
Pascal Title
The function layerCreation
will generate envirem rasters from input R
objects (rasterStacks) and will return the result as an R object. In contrast,
the function generateRasters
reads in input rasters from a specified directory,
splits input rasters into tiles if necessary, internally calls
layerCreation
and writes the result to file.
Possible variables to generate include:
annualPET
aridityIndexThornthwaite
climaticMoistureIndex
continentality
embergerQ
growingDegDays0
growingDegDays5
maxTempColdest
minTempWarmest
meanTempColdest
meanTempWarmest
monthCountByTemp10
PETColdestQuarter
PETDriestQuarter
PETseasonality
PETWarmestQuarter
PETWettestQuarter
thermicityIndex
If var = 'all'
, then all of the variables will be generated.
Rasters in mainDir
should be named appropriately (see verifyFileStructure
)
and with identical resolution, origin and extent.
Output rasters are written with the most appropriate dataType
, as
inferred with dataTypeCheck
. This will reduce the file size of these rasters.
If the goal is to use these rasters with the standalone Maxent program, we recommend
outputFormat = 'EHdr'
.
IMPORTANT: Temporary files can quickly fill up your hard drive when working with
large rasters. There are two temporary directories to consider for this function: The
tempDir
directory defined as an argument in this function is used for storing
intermediate files when splitting rasters into tiles (and is ignored if nTiles = 1
).
The raster package will use another directory for storing temporary rasters. This can be
can be viewed with rasterOptions()
, and can be set with
rasterOptions(tmpdir = 'path-to-dir')
. Be sure that this is pointing to a directory
with plenty of available space. Both temporary directories are automatically cleared.
Naming of rasters in inputDir will be checked with verifyFileStructure
.