File: datasource.Rd

package info (click to toggle)
r-cran-raster 3.6-31-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,300 kB
  • sloc: cpp: 2,367; ansic: 1,572; sh: 13; makefile: 2
file content (57 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
\name{datasource}

\alias{fromDisk}
\alias{inMemory}
\alias{inMemory,BasicRaster-method}
\alias{hasValues}
\alias{hasValues,BasicRaster-method}


\title{Are values in memory and/or on disk?}

\description{ 
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. 

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

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

\code{hasValues} is \code{TRUE} if the object has cell values.
}

\usage{
fromDisk(x)
\S4method{inMemory}{BasicRaster}(x)
\S4method{hasValues}{BasicRaster}(x)
}

\arguments{
  \item{x}{ Raster* object }
}

\value{
Logical
}

\examples{
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)
}

\keyword{ spatial }