Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »


In addition than to create multi-layer rasters from files, the functions stack and brick can also be used to create multi-layer rasters (RasterBrick object) from single layer rasters (RasterLayer objects).



EXAMPLE

Below an example where two single layers (single layer SPPC rasters for individual year seasons) are combined into a raster brick. Then names are assigned to the individual layers using  the function names from the 'raster' package.


This example is taken from the “Effects of Cyclone Yasi on Green Cover at Mission Beach” tutorial. Put the code snippets in context, by looking at a broader section of the R script, would likely be beneficial. Code snippets have a grey background, and outputs have a white background.


#==================================================================================
# Combine both Single-Layer Rasters (RasterLayer objects) into a Multi-Layer
# Raster (RasterBrick object)
#==================================================================================

SPGC.StudyArea.2010q3_2011q3.rb = brick(SPGC.StudyArea.2010q3.rl, SPGC.StudyArea.2011q3.rl)
names(SPGC.StudyArea.2010q3_2011q3.rb) = c("SPGC.SA.2010q3", "SPGC.SA.2011q3")        
SPGC.StudyArea.2010q3_2011q3.rb


## class       : RasterBrick 
## dimensions  : 295, 206, 60770, 2  (nrow, ncol, ncell, nlayers)
## resolution  : 30, 30  (x, y)
## extent      : 1484025, 1490205, -1996985, -1988135  (xmin, xmax, ymin, ymax)
## coord. ref. : +proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0 +y_0=0 +ellps=GRS80 +units=m +no_defs 
## data source : in memory
## names       : SPGC.SA.2010q3, SPGC.SA.2011q3 
## min values  :       39.21569,       39.21569 
## max values  :       77.25490,       76.86275
  • No labels