The GRVI is defined as the normalized ratio between the red and green channel of a RGB image or digital number triplet. However, the blue channel can be used as well using a weighting factor. As such a paramter vector is provided so different channels / DN can be weighted separately.
a PhenoCam data file or data frame (when using a file provide a full path if not in the current working directory)
grvi parameters (digital number weights)
return a data structure if given a file on disk
(TRUE
/ FALSE
= default)
output directory where to store data
Inserts a GRVI data column into the provided PhenoCam data structure or file.
if (FALSE) {
# with defaults, outputting a data frame
# with smoothed values, overwriting the original
# download demo data
download_phenocam(site = "harvard$",
veg_type = "DB",
roi_id = "1000",
frequency = "3")
# calculate and append the GRVI for a file (overwrites the original)
grvi(file.path(tempdir(),"harvard_DB_1000_3day.csv"))
# as all functions this also works on a PhenoCam data structure
df <- read_phenocam(file.path(tempdir(),"harvard_DB_1000_3day.csv"))
df <- grvi(df, par = c(1, 1, 0))
}