| write_caim | R Documentation |
Wrapper around terra::writeRaster() that writes a canopy image as GeoTIFF
with 8- or 16-bit unsigned integers, setting CRS and extent.
write_caim(caim, path, bit_depth)
caim |
terra::SpatRaster. |
path |
character vector of length one. Destination file path (extension
|
bit_depth |
numeric vector of length one. Either |
Adds the .tif extension to path if missing. The CRS is set to EPSG:7589
and the extent to [0, ncol] × [0, nrow] in pixel units. Data are written as
INT1U when bit_depth = 8 and INT2U when bit_depth = 16.
No return value. Called for side effects.
## Not run:
caim <- read_caim() %>% normalize_minmax(0, 255)
write_caim(caim * (2^8 - 1), file.path(tempdir(), "test_8bit"), 8)
write_caim(caim * (2^16 - 1), file.path(tempdir(), "test_16bit"), 16)
# Note: values are scaled by (2^bit_depth - 1) to avoid the maximum bin,
# which read_caim() might turn NA.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.