blockSize: Block size for writing files

Description Usage Arguments Value See Also Examples

View source: R/blockSize.R

Description

This function can be used to suggest chunk sizes (always a number of entire rows), and corresponding row numbers, to be used when processing Raster* objects in chunks. Normally used together with writeValues.

Usage

1
blockSize(x, chunksize, n=nlayers(x), minblocks=4, minrows=1)

Arguments

x

Raster* object

chunksize

Integer, normally missing. Can be used to set the block size; unit is number of cells. Block size is then computed in units of number of rows (always >= 1)

n

Integer. number of layers to consider. The function divides chunksize by n to determine blocksize

minblocks

Integer. Minimum number of blocks

minrows

Integer. Minimum number of rows in each block

Value

A list with three elements:

rows, the suggested row numbers at which to start the blocks for reading and writing,

nrows, the number of rows in each block, and,

n, the total number of blocks

See Also

writeValues

Examples

1
2
r <- raster(system.file("external/test.grd", package="raster"))
blockSize(r)

Example output

Loading required package: sp
$row
[1]  1 30 59 88

$nrows
[1] 29 29 29 28

$n
[1] 4

raster documentation built on Jan. 5, 2021, 3:01 a.m.