datasource.Rd
These are helper functions 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
i 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.
fromDisk(x)
# S4 method for class 'BasicRaster'
inMemory(x)
# S4 method for class 'BasicRaster'
hasValues(x)
Logical
rs <- raster(system.file("external/test.grd", package="raster"))
inMemory(rs)
#> [1] FALSE
fromDisk(rs)
#> [1] TRUE
rs <- readAll(rs)
inMemory(rs)
#> [1] TRUE
fromDisk(rs)
#> [1] FALSE
rs <- rs + 1
inMemory(rs)
#> [1] TRUE
fromDisk(rs)
#> [1] FALSE
rs <- raster(rs)
inMemory(rs)
#> [1] FALSE
fromDisk(rs)
#> [1] FALSE
rs <- setValues(rs, 1:ncell(rs))
inMemory(rs)
#> [1] TRUE
fromDisk(rs)
#> [1] FALSE
#rs <- writeRaster(rs, filename=rasterTmpFile(), overwrite=TRUE)
#inMemory(rs)
#fromDisk(rs)