grvi: Calculate green-red vegetation index (GRVI)

Description Usage Arguments Value Examples

View source: R/grvi.r

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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)

bnasr/phenocamrCS documentation built on June 5, 2020, 3:52 a.m.