PLUGPhenAnoRFDPLUS: Avocado algorithm - Single pixel version

View source: R/PLUGPhenAnoRFDPLUS.R

PLUGPhenAnoRFDPLUSR Documentation

Avocado algorithm - Single pixel version

Description

Calculate the Anomaly and their likelihood values (based on the difference between the pixel values and reference vegetation) for a numeric vector

Usage

PLUGPhenAnoRFDPLUS(x, phenref, dates, h, anop, rge)

Arguments

x

numeric vector. Time series of vegetation index (e.g. NDVI, EVI, NDMI)

phenref

List which contains cumulative bivariate density distribution and maximum likelihood of the vegetation-index–time space based on reference vegetation obtained from PhenRef2d

dates

A date vector. The number of dates must be equal to the number of values of time series.

h

Numeric. Geographic hemisphere to define the starting date of the growing season. h=1 Northern Hemisphere; h=2 Southern Hemisphere.

anop

Numeric vector with the number of values that are in x. For those values the anomalies and likelihoods will be calculated based on the phen. For example a time series has 450 values, so anop=c(1:450).

rge

A vector containing minimum and maximum values of the response variable used in the analysis. We suggest the use of theoretically based limits. For example in the case of MODIS NDVI or EVI, it ranges from 0 to 10,000, so rge =c(0,10000)

Value

vector of length([x]*2) containing all anomalies, followed by their position within the reference frequency distribution (RFD)

Author(s)

Roberto O. Chavez, Mathieu Decuyper

See Also

PLUGPhenAnoRFDMapPLUS

Examples

## Not run: 
# ===================================================================================================================
# Loading raster data
library(terra)
library(npphen)
MDD <- rast(system.file("extdata", "MDD_NDMI_1990_2020.tif", package = "AVOCADO"))
# load dates vector
load(system.file("extdata", "MDD_dates.RData", package = "AVOCADO"))
# load  reference forest data (output from PhenRef2d)
load(system.file("extdata", "MDD_forestReference.RData", package = "AVOCADO"))
## time series extraction for a single pixel
px <- vect(cbind(-69.265, -12.48))
plot(MDD[[1]])
plot(px, add = T)

# extract series
px_series <- as.numeric(terra::extract(MDD, px, ID = F))
plot(MDD_dates, px_series, type = "b", xlab = "", ylab = "NDMI")
## Anomaly calculation
anom_rfd <- PLUGPhenAnoRFDPLUS(x = px_series, phenref = MDD_fref, dates = MDD_dates, h = 2, anop = c(1:1063), rge = c(1, 10000))

## End(Not run)


MDecuy/AVOCADO documentation built on April 14, 2025, 5:30 a.m.