tsChips: Plot TS Chips

Description Usage Arguments Value Author(s) References Examples

Description

Plot image TS chips based on a location, area buffer, and time buffer

Usage

1
2
3
tsChips(x, loc, start = NULL, end = NULL, buff = 17, percNA = 20,
  cols = "PiYG", nbks = 35, nc = 3, nr = 3, plot = FALSE,
  plotlab = "data", exportChips = FALSE, exportZoo = FALSE, show = TRUE)

Arguments

x

RasterBrick. Image time series brick

loc

Location. Can be a vector of length 2 representing the x,y coordinates, or a SpatialPolygons or SpatialPoints object of nrow = 1 (the first row will be taken if nrow(loc) > 1), or an extent object (which will be extended if a buffer > 0 is given; see below)

start

Date. OptionaL: earliest date ("yyyy-dd-mm") to display.

end

Date. Optional: latest date ("yyyy-dd-mm") to display.

buff

Numeric. Number of pixels to buffer the location in all directions. A higher buffer will essentially zoom out.

percNA

Numeric. Maximum allowable % NA in the cropped image chips

cols

Character. Name of colour map to use (see display.brewer.all()) or a character vector with two or more colour names or hexadecimal values (as strings) between which to interpolate.

nbks

Numeric. Number of breaks in the colour map

plot

Logical. Plot pixel time series?

plotlab

Character. y-axis label for the pixel time series plot.

exportChips

Logical. Export processed chips to workspace as a rasterBrick?

exportZoo

Logical. Export pixel time series as a zoo object?

show

Logical. Plot the chips? Can be set to FALSE if you just want to export the chips as rasterBrick with or without the ggplot object.

nc/nr

Numeric. Number of columns and rows to plot, respectively. If the number of layers is greater than nc*nr, a screen prompt will lead to the next series of plots. These cannot exceed 4.

Value

NULL if exportChips = FALSE and exportZoo = FALSE, with the side effect of time series chips being plotted. If exportChips = TRUE, an object of type RasterBrick. if exportZoo = TRUE, an object of type zoo.

Author(s)

Ben DeVries

References

Cohen, W. B., Yang, Z., Kennedy, R. (2010). Detecting trends in forest disturbance and recovery using yearly Landsat time series: 2. TimeSync - Tools for calibration and validation. Remote Sensing of Environment, 114(12), 2911-2924.

Examples

 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
## Not run: 
library(bfastSpatial)
data(tura)

tsChips(tura, loc = c(820796, 831198))
tsChips(tura, loc = c(820796, 831198), buff = 50) # zoom out
tsChips(tura, loc = c(820796, 831198), buff = 50, percNA = 80) # allow more NA's in field of view
tsChips(tura, loc = c(820796, 831198), start = "2007-01-01", end = "2012-01-01", plot = TRUE, plotlab = 'NDVI') # restrict dates and produce pixel time series plot afterwards

# alternative colour scales
library(RColorBrewer)
display.brewer.all()
tsChips(tura, loc = c(820796, 831198), start = "1999-01-01", cols = "Spectral")
tsChips(tura, loc = c(820796, 831198), start = "1999-01-01", cols = "Greens")

tsChips(tura, loc = c(820796, 831198), start = "1999-01-01", cols = c("red", "yellow", "blue"))
tsChips(tura, loc = c(820796, 831198), start = "1999-01-01", cols = c("#DEEBF7", "#3182BD"))

# export image chips as a raster brick
chips <- tsChips(tura, loc = c(820796, 831198), start = "1999-01-01", percNA = 0, exportChips = TRUE)
chips2 <- tsChips(tura, loc = c(820796, 831198), start = "1999-01-01", percNA = 100, exportChips = TRUE)
nlayers(chips)
nlayers(chips2)

# export centre pixel time series as a zoo object
z <- tsChips(tura, loc = c(820796, 831198), start = "1999-01-01", exportZoo = TRUE)
plot(z)

# draw a custom SpatialPoygons object and plot around that
plot(tura, 42)
pol <- drawPoly(sp = TRUE) # click 'Finish' in plot window when done
projection(pol) <- projection(tura)
plot(tura, 42); plot(pol, add=TRUE)
tsChips(tura, loc = pol, start = "1999-01-01", plot = TRUE, plotlab = 'NDVI')

## End(Not run)

bendv/timeSyncR documentation built on May 12, 2019, 10:58 a.m.