Create an file-backed 'ff' object from a raster, or a raster-enabled file.

ff_object(x, readonly = TRUE, filename = NULL, ...)

# S3 method for BasicRaster
ff_object(x, readonly = TRUE, filename = NULL, ...)

# S3 method for character
ff_object(x, readonly = TRUE, filename = NULL, ...)

Arguments

x

raster or raster-able file

readonly

open in read-only mode (TRUE by default)

filename

path to file to create

...

arguments to methods

Value

`ff` object

Details

When the object is created from a filename, `raster::brick` is used. The 'dim'ension for raster and for ff in this context always keeps degenerate singletons. Please get in touch if this causes you problems.

Examples

f <- system.file("extdata", "raster", "sst.grd", package = "ffraster") ff_object(raster::brick(f))
#> ff (open) double length=1280 (1280) dim=c(16,8,10) dimorder=c(2,3,1)
if (interactive()) { arr <- ff_object(f, filename = "afile.grd") }
#> do you want to create a raster and write this object to a new file? #> afile.grd #> 1: Not yet #> 2: I forget #> 3: Yup #> #> Enter an item from the menu, or 0 to exit #> Enter an item from the menu, or 0 to exit #> Enter an item from the menu, or 0 to exit #> Enter an item from the menu, or 0 to exit #> Enter an item from the menu, or 0 to exit #> Enter an item from the menu, or 0 to exit