[Superseded]

Development on cropInputs(), projectInputs(), and maskInputs() is complete. For new code, use cropTo(), projectTo(), and maskTo() respectively (or the all-in-one postProcessTo()). These functions are retained and continue to work by delegating to their successors.

cropInputs(
  x,
  studyArea,
  rasterToMatch,
  verbose = getOption("reproducible.verbose", 1),
  ...
)

# Default S3 method
cropInputs(x, ...)

projectInputs(
  x,
  targetCRS,
  verbose = getOption("reproducible.verbose", 1),
  ...
)

# Default S3 method
projectInputs(x, targetCRS, ...)

maskInputs(x, studyArea, ...)

# Default S3 method
maskInputs(
  x,
  studyArea,
  rasterToMatch = NULL,
  maskWithRTM = NULL,
  verbose = getOption("reproducible.verbose", 1),
  ...
)

Arguments

x

An object to do a geographic raster::mask/raster::intersect. See methods.

studyArea

SpatialPolygons* object used for masking and possibly cropping if no rasterToMatch is provided. If not in same CRS, then it will be spTransformed to CRS of x before masking. Currently, this function will not reproject the x. Optional in postProcess.

rasterToMatch

Template Raster* object passed to the to argument of projectTo(), thus will changing the resolution and projection of x. See details in postProcessTo().

verbose

Numeric, -1 silent (where possible), 0 being very quiet, 1 showing more messaging, 2 being more messaging, etc. Default is 1. Above 3 will output much more information about the internals of Caching, which may help diagnose Caching challenges. Can set globally with an option, e.g., options('reproducible.verbose' = 0) to reduce to minimal

...

Passed to methods. None currently implemented.

targetCRS

The CRS of x at the end of this function (i.e., the goal)

maskWithRTM

Logical. If TRUE, the rasterToMatch will be used as the masking object (masking with its NA values); otherwise studyArea is used.

Value

A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been appropriately cropped.

A file of the same type as starting, but with projection (and possibly other characteristics, including resolution, origin, extent if changed).

A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been appropriately reprojected.

A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been appropriately masked.

Details

cropInputs() crops a Spatial* or Raster* object. If used, all arguments will be passed to cropTo anyway.

projectInputs() reprojects a Raster*, Spatial*, or sf object.

maskInputs() masks a raster or vector object to a study area.

See also

projectTo()

maskTo(), postProcessTo() for related examples

Author

Eliot McIntire, Jean Marchal, Ian Eddy, and Tati Micheletti

Eliot McIntire and Jean Marchal