ff_raster: Create an ffraster

Description Usage Arguments Details Examples

View source: R/ff_raster_create.R

Description

Use a raster template to set up an ff array for filling.

Usage

1
ff_raster(x, nlayers = NULL, filename = NULL, ..., setZ = NULL)

Arguments

x

a raster object, used as the template for the data to come

nlayers

the number of layers to instantiate

filename

the .grd filename

...

arguments passed to .writeGRD

setZ

optional z values, must be of length 'nlayers'

Details

Note that no data is transferred, this is a set up function to give an ff array to be populated.

There is currently no control over the bandorder, set to band interleaved (BIL) currently.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
n <- 5
files <- raadtools::sstfiles()[1:n, ]

library(raster)
fun <- function(date) raadtools::readsst(date, xylim = extent(120, 160, -50, -30), inputfiles = files)
arr <- ff_raster(fun(files$date[1]), nlayers = n, filename = "afile.grd", overwrite = TRUE)
for (i in seq_along(files$date)) {
arr[,,i] <-   raster::values(t(fun(files$date[i])))
}
# plot(brick("afile.grd"))

## End(Not run)

mdsumner/ffraster documentation built on May 22, 2019, 4:44 p.m.