datasource: Are values in memory and/or on disk?

Description Usage Arguments Value Examples

Description

These are helper functons for programmers and for debugging that provide information about whether a Raster object has associated values, and if these are in memory or on disk.

fromDisk is TRUE if the data source is a file on disk; and FALSE if the object only exists in memory.

inMemory is TRUE if all values are currently in memory (RAM); and FALSE if not (in which case they either are on disk, or there are no values).

hasValues is TRUE if the object has cell values.

Usage

1
2
3
4
fromDisk(x)
inMemory(x)
## S4 method for signature 'BasicRaster'
hasValues(x, ...)

Arguments

x

Raster* object

...

additional arguments. None implemented

Value

Logical

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
rs <- raster(system.file("external/test.grd", package="raster"))
inMemory(rs)
fromDisk(rs)
rs <- readAll(rs)
inMemory(rs)
fromDisk(rs)
rs <- rs + 1
inMemory(rs)
fromDisk(rs)
rs <- raster(rs)
inMemory(rs)
fromDisk(rs)
rs <- setValues(rs, 1:ncell(rs))
inMemory(rs)
fromDisk(rs)
#rs <- writeRaster(rs, filename=rasterTmpFile(), overwrite=TRUE)
#inMemory(rs)
#fromDisk(rs)

Example output

Loading required package: sp
[1] FALSE
[1] TRUE
[1] TRUE
[1] FALSE
[1] TRUE
[1] FALSE
[1] FALSE
[1] FALSE
[1] TRUE
[1] FALSE

raster documentation built on May 3, 2021, 9:05 a.m.