Using upper quantile (default = 0.925) of multi-year MODIS data, determine the top NDVI for each id.

filter_top(DT, probs = 0.925, id = "id")

Arguments

DT

data.table of NDVI time series

probs

quantile probability to determine top. default is 0.925.

id

id column. default is 'id'. See details.

Value

filtered data.table with appended 'top' column of each id's top (quantile) NDVI value.

Details

The id argument is used to split between sampling units. This may be a point id, polygon id, pixel id, etc. depending on your analysis.

See also

Examples

# Load data.table library(data.table) # Read example data ndvi <- fread(system.file("extdata", "ndvi.csv", package = "irg")) filter_qa(ndvi, qa = 'SummaryQA', good = c(0, 1)) filter_winter(ndvi, probs = 0.025, limits = c(60L, 300L), doy = 'DayOfYear', id = 'id')
#> id yr DayOfYear NDVI SummaryQA filtered winter #> 1: 1 2002 3 -1367 3 4099 4099 #> 2: 2 2002 14 -304 3 5382 5382 #> 3: 3 2002 1 374 2 3702 3702 #> 4: 4 2002 15 635 3 5180 5180 #> 5: 5 2002 9 685 2 4621 4621 #> --- #> 1261: 1 2012 353 151 2 4099 4099 #> 1262: 2 2012 356 330 2 5382 5382 #> 1263: 3 2012 356 560 2 3702 3702 #> 1264: 4 2012 356 1720 2 5180 5180 #> 1265: 5 2012 356 2689 2 4621 4621
filter_roll(ndvi, window = 3L, id = 'id')
#> id yr DayOfYear NDVI SummaryQA filtered winter rolled #> 1: 1 2002 3 -1367 3 4099 4099 4099 #> 2: 2 2002 14 -304 3 5382 5382 5382 #> 3: 3 2002 1 374 2 3702 3702 3702 #> 4: 4 2002 15 635 3 5180 5180 5180 #> 5: 5 2002 9 685 2 4621 4621 4621 #> --- #> 1261: 1 2012 353 151 2 4099 4099 4099 #> 1262: 2 2012 356 330 2 5382 5382 5382 #> 1263: 3 2012 356 560 2 3702 3702 3702 #> 1264: 4 2012 356 1720 2 5180 5180 5180 #> 1265: 5 2012 356 2689 2 4621 4621 4621
filter_top(ndvi, probs = 0.925, id = 'id')
#> id yr DayOfYear NDVI SummaryQA filtered winter rolled top #> 1: 1 2002 3 -1367 3 4099 4099 4099 7443.4 #> 2: 2 2002 14 -304 3 5382 5382 5382 7462.9 #> 3: 3 2002 1 374 2 3702 3702 3702 6709.8 #> 4: 4 2002 15 635 3 5180 5180 5180 7288.1 #> 5: 5 2002 9 685 2 4621 4621 4621 7645.1 #> --- #> 1261: 1 2012 353 151 2 4099 4099 4099 7443.4 #> 1262: 2 2012 356 330 2 5382 5382 5382 7462.9 #> 1263: 3 2012 356 560 2 3702 3702 3702 6709.8 #> 1264: 4 2012 356 1720 2 5180 5180 5180 7288.1 #> 1265: 5 2012 356 2689 2 4621 4621 4621 7645.1