View source: R/PLUGPhenAnoRFDPLUS.R
PLUGPhenAnoRFDPLUS | R Documentation |
Calculate the Anomaly and their likelihood values (based on the difference between the pixel values and reference vegetation) for a numeric vector
PLUGPhenAnoRFDPLUS(x, phenref, dates, h, anop, rge)
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 |
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) |
vector of length([x]*2) containing all anomalies, followed by their position within the reference frequency distribution (RFD)
Roberto O. Chavez, Mathieu Decuyper
PLUGPhenAnoRFDMapPLUS
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.