grvi: Calculate green-red vegetation index (GRVI)

View source: R/grvi.r

grviR Documentation

Calculate green-red vegetation index (GRVI)

Description

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.

Usage

grvi(data, par = c(1, 1, 1), internal = TRUE, out_dir = tempdir())

Arguments

data

a PhenoCam data file or data frame (when using a file provide a full path if not in the current working directory)

par

grvi parameters (digital number weights)

internal

return a data structure if given a file on disk (TRUE / FALSE = default)

out_dir

output directory where to store data

Value

Inserts a GRVI data column into the provided PhenoCam data structure or file.

Examples


## Not run: 
# 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))

## End(Not run)

phenocamr documentation built on July 21, 2022, 1:06 a.m.