Description Usage Arguments Details Value See Also Examples
A RasterBrick is a multi-layer raster object. They are typically created from a multi-layer (band) file; but they can also exist entirely in memory. They are similar to a RasterStack (that can be created with stack
), but processing time should be shorter when using a RasterBrick. Yet they are less flexible as they can only point to a single file.
A RasterBrick can be created from RasterLayer objects, from a RasterStack, or from a (multi-layer) file. The can also be created from SpatialPixels*, SpatialGrid*, and Extent objects, and from a three-dimensional array.
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 | ## S4 method for signature 'character'
brick(x, ...)
## S4 method for signature 'RasterStack'
brick(x, values=TRUE, nl, filename='', ...)
## S4 method for signature 'RasterBrick'
brick(x, nl, ...)
## S4 method for signature 'RasterLayer'
brick(x, ..., values=TRUE, nl=1, filename='')
## S4 method for signature 'missing'
brick(nrows=180, ncols=360, xmn=-180, xmx=180, ymn=-90, ymx=90, nl=1, crs)
## S4 method for signature 'Extent'
brick(x, nrows=10, ncols=10, crs="", nl=1)
## S4 method for signature 'array'
brick(x, xmn=0, xmx=1, ymn=0, ymx=1, crs="", transpose=FALSE)
## S4 method for signature 'SpatialGrid'
brick(x)
## S4 method for signature 'SpatialPixels'
brick(x)
|
x |
character (filename, see Details); Raster* object; missing; array; SpatialGrid*; SpatialPixels*; Extent; or list of Raster* objects. Supported file types are the 'native' raster package format and those that can be read via rgdal (see |
... |
see Details |
values |
logical. If |
nl |
integer > 0. How many layers should the RasterBrick have? |
filename |
character. Filename if you want the RasterBrick to be saved on disk |
nrows |
integer > 0. Number of rows |
ncols |
integer > 0. Number of columns |
xmn |
minimum x coordinate (left border) |
xmx |
maximum x coordinate (right border) |
ymn |
minimum y coordinate (bottom border) |
ymx |
maximum y coordinate (top border) |
crs |
character or object of class CRS. PROJ4 type description of a Coordinate Reference System (map projection). If this argument is missing, and the x coordinates are within -360 .. 360 and the y coordinates are within -90 .. 90, "+proj=longlat +datum=WGS84" is used |
transpose |
if |
If x
is a RasterLayer, the additional arguments can be used to pass additional Raster* objects.
If there is a filename
argument, the additional arguments are as for writeRaster
.
If x
represents a filename there is the following additional argument:
native
: logical. If TRUE
(not the default), reading and writing of IDRISI, BIL, BSQ, BIP, and Arc ASCII files is done with native (raster package) drivers, rather then via rgdal.
In addition, if x
is a NetCDF filename there are the following additional arguments:
varname
: character. The variable name (e.g. 'altitude' or 'precipitation'. If not supplied and the file has multiple
variables are a guess will be made (and reported))
lvar
: integer > 0 (default=3). To select the 'level variable' (3rd dimension variable) to use, if the file has 4 dimensions (e.g. depth instead of time)
level
: integer > 0 (default=1). To select the 'level' (4th dimension variable) to use, if the file has 4 dimensions, e.g. to create a RasterBrick of weather over time at a certain height.
dims
: integer vector to indicated the order of the dimensions. Default is dims=c(1,2,3)
(rows, cols, time).
To use NetCDF files the ncdf4
package needs to be available. It is assumed that these files follow, or are compatible with the CF-1 convention.
RasterBrick
1 2 3 4 5 | b <- brick(system.file("external/rlogo.grd", package="raster"))
b
nlayers(b)
names(b)
extract(b, 870)
|
Loading required package: sp
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
class : RasterBrick
dimensions : 77, 101, 7777, 3 (nrow, ncol, ncell, nlayers)
resolution : 1, 1 (x, y)
extent : 0, 101, 0, 77 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=merc +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : /usr/lib/R/site-library/raster/external/rlogo.grd
names : red, green, blue
min values : 0, 0, 0
max values : 255, 255, 255
[1] 3
[1] "red" "green" "blue"
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
red green blue
[1,] 149 149 137
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.