| read_bin | R Documentation |
Wrapper functions around terra::rast() to read and write binary masks.
read_bin(path)
write_bin(bin, path)
path |
character vector of length one. File path to read or write. See examples. |
bin |
logical terra::SpatRaster with a single layer. |
write_bin() multiplies the input logical raster by 255 and writes the
result as a GeoTIFF (GTiff) with datatype INT1U. Both write_bin() and
read_bin() set the raster extent to terra::ext(0, ncol(r), 0, nrow(r))
and the CRS to EPSG:7589.
See Functions
write_binWrite a one-layer logical terra::SpatRaster
to disk as a GeoTIFF (GTiff, INT1U). No return value.
read_binRead a file with values 255 and/or 0, such as the one
produced by write_bin (see Details), and return a logical
terra::SpatRaster (TRUE for 255, FALSE for 0).
read_caim(), write_caim().
## Not run:
z <- zenith_image(1000, lens())
m <- !is.na(z)
my_file <- file.path(tempdir(), "mask.tif")
write_bin(m, my_file)
m_from_disk <- read_bin(my_file)
plot(m - m_from_disk)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.