# \dontshow{
## Testing the function with an NDVI time series of a deciduous Nothofagus macrocarpa forest
# Load data
data("phents")
# PhenKplot for the given data
PhenKplot(
x = phents$NDVI, dates = phents$dates, h = 2,
xlab = "Day of the growing season",
ylab = "NDVI", rge = c(0, 10000)
)
# }
# \donttest{
library(lubridate)
library(terra)
## Testing raster data from Central Chile (NDVI), h=2##
# Load data
f <- system.file("extdata/MegaDrought_spatRast.rda", package = "npphen")
MegaDrought <- readRDS(f)
# Dates
data("modis_dates")
# Generate a Raster time series from a particular pixel
# using a SpatRaster and a date for Central Chile
md_pixel <- cellFromXY(MegaDrought, cbind(313395, 6356610))
md_pixelts <- as.numeric(MegaDrought[md_pixel])
plot(modis_dates, md_pixelts, type = "l")
# Variability of the annual phenology for the given pixel
PhenKplot(x = md_pixelts, dates = modis_dates,
h = 2, xlab = "DGS", ylab = "NDVI", rge = c(0, 10000))
## Testing with the Bdesert_spatRast from
## the Atacama Desert, Northern Chile (NDVI), h=2 ##
# Load data
# SparRaster
f <- system.file("extdata/Bdesert_spatRast.rda", package = "npphen")
Bdesert <- readRDS(f)
# Generate a Raster time series from a particular pixel
# using a SpatRaster and a date for Northern Chile
bd_pixel <- cellFromXY(Bdesert, cbind(286638, 6852107))
bd_pixelts <- as.numeric(Bdesert[bd_pixel])
plot(modis_dates, bd_pixelts, type = "l")
# Variability of the annual phenology for the given pixel
PhenKplot(x = bd_pixelts, dates = modis_dates,
h = 2, xlab = "DGS", ylab = "NDVI", rge = c(0, 10000))
# }
Run the code above in your browser using DataLab