zvalues: Get or set z-values

Description Usage Arguments Value Examples

Description

Initial functions for a somewhat more formal approach to get or set z values (e.g. time) associated with layers of Raster* objects. In development.

Usage

1
2
setZ(x, z, name='time')
getZ(x)

Arguments

x

Raster* object

z

vector of z values of any type (e.g. of class 'Date')

name

character label

Value

setZ: Raster* object

getZ: vector

Examples

1
2
3
4
5
r <- raster(ncol=10, nrow=10)
s <- stack(lapply(1:3, function(x) setValues(r, runif(ncell(r)))))
s <- setZ(s, as.Date('2000-1-1') + 0:2)
s
getZ(s)

Example output

Loading required package: sp
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
class       : RasterStack 
dimensions  : 10, 10, 100, 3  (nrow, ncol, ncell, nlayers)
resolution  : 36, 18  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
names       :     layer.1,     layer.2,     layer.3 
min values  : 0.010540558, 0.022090215, 0.001772651 
max values  :   0.9940682,   0.9975485,   0.9924746 
time        : 2000-01-01, 2000-01-02, 2000-01-03 

[1] "2000-01-01" "2000-01-02" "2000-01-03"

raster documentation built on Jan. 5, 2021, 3:01 a.m.