fixErrors –> fixErrosTerra
See writeTo()
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),
...
)
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
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.
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
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.
Passed into writeTo()
Logical. Should file being written overwrite an existing file if it exists.
A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been attempted to be fixed, if it finds errors.
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.
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.042 secs
#> class : SpatRaster
#> size : 10, 10, 1 (nrow, ncol, nlyr)
#> resolution : 10, 10 (x, y)
#> extent : 0, 100, 0, 100 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> source : file2102238309ac.tif
#> name : lyr.1
#> min value : 1
#> max value : 100