bfmPixel: Apply bfmastmonitor on a single pixel

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Apply bfastmonitor (bfm) on a single pixel of known cell index (by supplying a single numeric value for cell), xy coordinates (cell=c(x, y)), or interactively by clicking on a plot (by setting interactive=TRUE). Outputs a list with (1) an object of class 'bfastmonitor' and (2) the resulting cell number (useful for follow-up analysis).

Usage

1
2
3
bfmPixel(x, dates = NULL, start, monend = NULL, cell = NULL, f = 1,
  min.thresh = NULL, sensor = NULL, interactive = FALSE, plot = FALSE,
  ...)

Arguments

x

RasterBrick with raster time series data.

start

Numeric. Vector of length = 2 representing the start of the monitoring period (in the format c(year, julian day))

monend

Numeric. Optional: the end of the monitoring period (in the format c(year, julian day)), at which point the time series will be trimmed.

cell

Numeric. Can be one of: (1) a numeric of length 1 indicating the raster cell to be observed; (2) a numeric of length 2 representing the (x,y) coordinate of the raster cell to be observed. Can also be omitted, in which case 'interactive' must be set to TRUE (see below)

f

Numeric. Factor by which to rescale values before running bfastmonitor. Defaults to 1 (no rescaling)

min.thresh

Numeric. Optional: A minimum threshold below which NA's are assigned to data points. NOTE: the threshold is applied before rescaling the data by f (see above)

sensor

Character. Optional: Limit analysis to data from one or more sensors. Can be one or more of c("ETM+", "ETM+ SLC-on", "ETM+ SLC-off", "TM", "OLI") according to the sensor information returned by getSceneinfo

interactive

Logical. Select cell by clicking on an already plotted map? Defaults to FALSE. If FALSE, a value must be assigned to cell (see above).

plot

Logical. Plot the result? Defaults to FALSE.

...

Arguments to be passed to bfastmonitor

Details

bfmPixel is theoretically designed to work on any generic raster time series, as long as a dates vector is provided. In the absence of a dates vector, names(x) should correspond exactly to respective Landsat scene ID's. In this case, getSceneinfo is used to extract a dates vector, and subset by sensor if desired.

Value

A list with the following components: 1) $bfm - an object of class 'bfastmonitor' (see bfastmonitor) 2) $cell - the cell index (an integer of length 1). This can be used to run bfmPixel again on the same pixel (with different parameters) without having to click on a plot again to find the same pixel (in that case, be sure to set interactive=FALSE for subsequent trials!).

Author(s)

Ben DeVries

See Also

bfastmonitor, bfmSpatial

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
37
38
# load in time series raster data
data(tura)

# run bfm on a pixel of known (x,y) location
bfm <- bfmPixel(tura, cell=c(820900, 831340), start=c(2005, 1))
print(bfm$cell) # check the corresponding cell index

# get bfm results for a pixel of known cell index
targcell <- 4064
bfm <- bfmPixel(tura, cell=targcell, start=c(2005, 1))
plot(bfm$bfm)
# try another monitoring period
bfm <- bfmPixel(tura, cell=targcell, start=c(2009, 1))
plot(bfm$bfm)

# try again using only ETM+ data (Landsat 7)
bfm <- bfmPixel(tura, cell=1068, start=c(2005, 1), sensor="ETM+")
plot(bfm$bfm) 

## Not run: 
# run bfm on a pixel chosen from the plot window
plot(tura, 6) # a cloudless scene from 2001
bfm <- bfmPixel(tura, start=c(2005, 1), sensor="ETM+", interactive=TRUE)
plot(bfm$bfm)
print(targcell <- bfm$cell) # store cell index for follow-up analysis

## change the model parameters
# 1. harmonic order
bfm <- bfmPixel(tura, cell=targcell, start=c(2005, 1), sensor="ETM+", order=3)
plot(bfm$bfm)
# 2. no trend
bfm <- bfmPixel(tura, cell=targcell, start=c(2005, 1), sensor="ETM+", order=3, formula=response~harmon)
plot(bfm$bfm)
# 3. trend only
bfm <- bfmPixel(tura, cell=targcell, start=c(2005, 1), sensor="ETM+", formula=response~trend)
plot(bfm$bfm)

## End(Not run)

loicdtx/bfastSpatial documentation built on May 21, 2019, 7:37 a.m.