Learn R Programming

SpaDES.tools (version 0.1.1)

prepInputs: Download and optionally reproject, crop, mask raw data and output module inputs

Description

This function can be used to prepare module inputs from raw data. It runs several other functions, conditionally: extractFromArchive.

Usage

prepInputs(targetFile, archive = NULL, modulePath, moduleName,
  fun = "raster", pkg = "raster", studyArea = NULL,
  rasterToMatch = NULL, rasterInterpMethod = "bilinear",
  rasterDatatype = "INT2U", writeCropped = TRUE, addTagsByObject = NULL,
  quick = FALSE, cacheTags = "stable")

Arguments

targetFile

Character string giving the path of the raw data.

archive

Optional character string giving the path of an archive containing targetFile.

modulePath

Character string giving the path to the module directory.

moduleName

Character string giving the name of the module.

fun

Character string indicating the function to use to load targetFile.

pkg

Character string indicating the package in which to find fun.

studyArea

spatial* or sf object used for cropping and masking.

rasterToMatch

Template Raster* object used for reprojecting and cropping.

rasterInterpMethod

Method used to compute values for the new RasterLayer. See projectRaster. Defaults to bilinear.

rasterDatatype

Output data type. Passed to writeRaster.

writeCropped

Write the output on disk ?

addTagsByObject

Pass any object in there for which there is a .tagsByClass function

quick

Logical. If sideEffect = TRUE, setting this to TRUE, will hash the file's metadata (i.e., filename and file size) instead of hashing the contents of the file(s). If set to FALSE (default), the contents of the file(s) are hashed. NOTE: this argument is experimental and may change in future releases.

cacheTags

Character vector with Tags. These Tags will be added to the repository along with the artifact.