This function is deprecated. Use cropTo
. If used, all arguments will be passed
to cropTo
anyway.
fixErrors
–> fixErrosTerra
Deprecated. Use projectTo()
.
maskInputs
is deprecated. Use maskTo()
See writeTo()
cropInputs(
x,
studyArea,
rasterToMatch,
verbose = getOption("reproducible.verbose", 1),
...
)
# Default S3 method
cropInputs(x, ...)
fixErrors(
x,
objectName,
attemptErrorFixes = TRUE,
useCache = getOption("reproducible.useCache", FALSE),
verbose = getOption("reproducible.verbose", 1),
testValidity = getOption("reproducible.testValidity", TRUE),
...
)
# Default S3 method
fixErrors(
x,
objectName,
attemptErrorFixes = TRUE,
useCache = getOption("reproducible.useCache", FALSE),
verbose = getOption("reproducible.verbose", 1),
testValidity = getOption("reproducible.testValidity", TRUE),
...
)
projectInputs(
x,
targetCRS,
verbose = getOption("reproducible.verbose", 1),
...
)
# Default S3 method
projectInputs(x, targetCRS, ...)
maskInputs(x, studyArea, ...)
writeOutputs(
x,
...,
overwrite = getOption("reproducible.overwrite", NULL),
verbose = getOption("reproducible.verbose", 1)
)
# Default S3 method
writeOutputs(
x,
...,
overwrite = getOption("reproducible.overwrite", FALSE),
verbose = getOption("reproducible.verbose", 1)
)
The object save to disk i.e., write outputs
SpatialPolygons*
object used for masking and possibly cropping
if no rasterToMatch
is provided.
If not in same CRS, then it will be spTransform
ed to
CRS of x
before masking. Currently, this function will not reproject the
x
. Optional in postProcess
.
Template Raster*
object passed to the to
argument of
projectTo()
, thus will changing the
resolution and projection of x
.
See details in postProcessTo()
.
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 into writeTo()
Optional. This is only for messaging; if provided, then messages relayed to user will mention this.
Will attempt to fix known errors. Currently only some failures
for SpatialPolygons*
are attempted.
Notably with terra::buffer(..., width = 0)
.
Default TRUE
, though this may not be the right action for all cases.
Logical, default getOption("reproducible.useCache", FALSE)
, whether
Cache is used on the internal terra::buffer
command.
Logical. If TRUE
, the a test for validity will happen
before actually running buffering (which is the solution in most
cases). However, sometimes it takes longer to test for validity
than just buffer without testing (there are no consequences of
buffering if everything is valid). If FALSE
, then the
test will be skipped and the buffering will happen regardless.
If NA
, then all testing and buffering will be skipped.
The CRS of x at the end of this function (i.e., the goal)
Logical. Should file being written overwrite an existing file if it exists.
A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been appropriately cropped.
A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been attempted to be fixed, if it finds errors.
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.
A GIS file (e.g., SpatRaster etc.) that has been appropriately written to disk. In the case of vector datasets, this will be a side effect. In the case of gridded objects (Raster*, SpatRaster), the object will have a file-backing.
fixErrorsIn()
, postProcessTo()
, postProcess()
maskTo()
, postProcessTo()
for related examples
if (requireNamespace("terra", quietly = TRUE)) {
r <- terra::rast(terra::ext(0, 100, 0, 100), vals = 1:1e2)
tf <- tempfile(fileext = ".tif")
writeOutputs(r, tf)
}
#> writing...
#> done! took: 0.00948 secs
#> class : SpatRaster
#> dimensions : 10, 10, 1 (nrow, ncol, nlyr)
#> resolution : 10, 10 (x, y)
#> extent : 0, 100, 0, 100 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> source : file208c1ccab6d7.tif
#> name : lyr.1
#> min value : 1
#> max value : 100