pack/unpack rle
Closed this issue · 1 comments
mdsumner commented
Internal functions pack_raster and unpack_raster.
Only suitable for polygon seas.
## classic fasterize
library(fasterize)
library(raster)
library(stars)
library(dplyr)
nr <- 360
nc <- 720
r0 <- raster(extent(-180, 180, -90, 90), nrows = nr, ncols = nc, crs = "+init=epsg:4326")
pols <- rnaturalearth::ne_countries(returnclass = "sf")
pols$row_index <- as.integer(seq_len(nrow(pols)))
## fudge this happy future day of cell abstraction
dummy <- fasterize(pols, r0, field = "row_index")
index <- pack_raster(dummy)
plot(unpack_raster(r0, index))
pryr::object_size(dummy)
pryr::object_size(index)
was started at rgdal-dev/rasterwise#9
mdsumner commented
see hypertidy/controlledburn