Skip to contents

Estimates annual Land Surface Phenology (LSP) using time series of a vegetation greenness raster stack.

Usage

PhenMap(s, dates, h, frequency = "16-days", nCluster, outname, datatype, rge)

Arguments

s

SpatRaster of a vegetation index (e.g. LAI, NDVI, EVI) or any other variable with seasonal behavior. The code has been optimized to work with integer values. Please re-scale the input SpatRaster if necessary (e.g. NDVI ranging from 0.0000 to 1.0000, multiply by 10,000)

dates

A date vector. The number of dates must be equal to the number of layers of the vegetation index SpatRaster.

h

Numeric. Indicates the geographic hemisphere to define the starting date of the growing season. h = 1 if the vegetation is in the Northern Hemisphere (season starting on January 1st), h = 2 if it is in the Southern Hemisphere (season starting on July 1st)

frequency

Character string. Defines the number of samples for the output phenology and must be one of the following options: 'daily' with an output vector of length 365, '8-days' with an output vector of length 46 (e.g. MOD13Q1 and MYD13Q1 combined), 'monthly' with an output vector of length 12,'bi-weekly' with an output vector of length 24 (i.e. GIMMS) or '16-days' (default) with an output vector of length 23 (i.e MOD13Q1 or MYD13Q1)

nCluster

Numeric. Number of CPU cores to be used for computational calculations

outname

Character vector with the output directory path and filename with extension or only the filename and extension if working directory was set. For example outname = "output_phen.tif". See writeRaster

datatype

Character. Output data type. For example datatype = "INT2S" for signed integer values. See writeRaster

rge

A vector containing minimum and maximum values of the vegetation index 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

SpatRaster

Details

Per pixel, it derives the most recurrent annual Land Surface Phenology (LSP) for a reference period using time series of satellite based greenness values such as the Normalized Difference Vegetation Index (NDVI) or Enhanced Vegetation Index (EVI). The annual LSP is calculated for all pixels of the input SpatRaster in the same way as for the Phen function. The output is a multiband raster where every band is the expected greenness value at a given time step of the growing season. For example, for MODIS Vegetation Index 16-days composites the number of time steps of the growing season is 23 (frequency = "16-days"), and therefore, the output raster will have 23 bands. A vector with dates for the greenness values is also required

See also

Examples

if (FALSE) { # \dontrun{
## DEPENDING ON HARDWARE, THIS PROCESS CAN BE HIGHLY TIME CONSUMING##

## Testing with an NDVI spatRast from Central Chile, h = 2##

# Load data
# SpatRaster
library(terra)
f <- system.file("extdata/MegaDrought_spatRast.rda", package = "npphen")
MegaDrought <- readRDS(f)
# Dates
data("modis_dates")

# Making the LSP output raster, n bands = 23

# Define the number of cores to be use. In this example we use 1
nc1 <- 1

PhenMap(
  s = MegaDrought, dates = modis_dates, h = 2,
  frequency = "16-days", nCluster = nc1, outname = "phen_MD.tif",
  datatype = "INT2S", rge = c(0, 10000)
)
# map1 <- rast("phen_MD.tif")#run only for load phenology brick
# plot(map1)

## Testing with an NDVI spatRast from the Atacama Desert, Northern Chile, h=2 ##

# Load data
SpatRaster
f <- system.file("extdata/Bdesert_spatRast.rda", package = "npphen")
Bdesert <- readRDS(f)
# Dates
data("modis_dates")

# Making the LSP output raster, n bands = 23
# Define the number of cores to be use. In this example we use 1
nc1 <- 1

PhenMap(
  s = Bdesert, dates = modis_dates, h = 2,
  frequency = "16-days", nCluster = 1, outname = "phen_BD.tif",
  datatype = "INT2S", rge = c(0, 10000)
)
# map2 <- rast("phen_BD.tif") #run only for loading the multiband LSP spatRaster
# plot(map2)
} # }