PLUGPhenAnoRFDMapPLUS: Avocado algorithm - Wall-to-wall map version

View source: R/PLUGPhenAnoRFDPLUS.R

PLUGPhenAnoRFDMapPLUSR Documentation

Avocado algorithm - Wall-to-wall map version

Description

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

Usage

PLUGPhenAnoRFDMapPLUS(s, phenref, dates, h, anop, nCluster, outname, datatype)

Arguments

s

SpatRaster 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).

nCluster

Numeric. Number of CPU's to be used for the job.

outname

Character vector with the output path and filename with extension or only the filename and extension if work directory was set. More information: See writeRaster

datatype

Character vector that determines the interpretation of values written to disk. More information: See writeRaster

Value

SpatRaster of nlayers([s]stack*2) containing all anomalies, followed by their likelihoods

Author(s)

Roberto O. Chavez, Mathieu Decuyper

See Also

PLUGPhenAnoRFDPLUS

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"))

## Anomaly calculation
# checking availiable cores and leave one free
nc1 <- parallel::detectCores() - 1
PLUGPhenAnoRFDMapPLUS(
  s = MDD, dates = MDD_dates, h = 1, phenref = MDD_fref, anop = c(1:1063),
  nCluster = nc1, outname = "YourDirectory/MDD_AnomalyLikelihood.tif",
  datatype = "INT2S")
)
# The output file contains all the anomalies, followed by all their likelihoods
# and thus has twice the number of layers as the input raster stack.

## End(Not run)

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