varEVI: Calculate the enhanced vegetation index (EVI)

Description Usage Arguments Details Value References Examples

View source: R/varEVI.R

Description

varEVI computes the enhanced vegetation index (EVI) from the blue, near-infrared (NIR) and red bands.

Usage

1
2
3
varEVI(blue, red, nir, scfun = function(r) {
    r
})

Arguments

blue

a raster with the blue band of the capture.

red

a raster with the red band of the capture.

nir

a raster with the NIR band of the capture.

scfun

a function to re-scale the original pixel values into reflectance (0-1).

Details

The enhanced vegetation index (EVI) is a vegetation indicator that improves the sensitivity towards high biomass densities compared to NDVI \insertCitehuete2002overviewRGISTools (See varNDVI). This function is used within ls7FolderToVar, ls8FolderToVar, modFolderToVar and senFolderToVar.

Value

An EVI image in raster format.

References

\insertRef

huete2002overviewRGISTools

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# path to the cropped and cutted MODIS images for the region of Navarre
wdir <- system.file("ExNavarreVar", package = "RGISTools")
# list all the tif files
files.mod <- list.files(wdir, pattern = "\\.tif$", recursive = TRUE, full.names = TRUE)
# print the MOD09 bands
getRGISToolsOpt("MOD09BANDS")
scale.factor <- 0.0001

# select the red, blue and nir bands
img.mod.red <- raster(files.mod[1]) * scale.factor
img.mod.blue <- raster(files.mod[3]) * scale.factor
img.mod.nir <- raster(files.mod[2]) * scale.factor
# calculate the EVI without scale
img.mod.evi <- varEVI(img.mod.blue, img.mod.red, img.mod.nir)
# calculate the EVI scaling 0-1
img.mod.evi.2 <- varEVI(img.mod.blue, img.mod.red, img.mod.nir,scfun=getRGISToolsOpt("MOD09SCL"))
img.mod.evi.12 <- stack(img.mod.evi,img.mod.evi.2)
# plot the image
spplot(img.mod.evi.12,col.regions=rev(terrain.colors(20)),at = c(seq(0,1,0.05)))

Example output

Loading required package: raster
Loading required package: sp
Loading required package: sf
Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
Loading required package: tmap
           red            nir           blue          green          tirs1 
       "B01_1"        "B02_1"        "B03_1"        "B04_1"        "B05_1" 
         swir1          swir2        quality          cloud 
       "B06_1"        "B07_1" "_state_1km_1"          "CLD" 
sh: 1: awk: Permission denied
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded ellps unknown in CRS definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +R=6371007.181 +units=m +no_defs +type=crs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum unknown in CRS definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded ellps unknown in CRS definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +R=6371007.181 +units=m +no_defs +type=crs
4: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum unknown in CRS definition
sh: 1: awk: Permission denied
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded ellps unknown in CRS definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +R=6371007.181 +units=m +no_defs +type=crs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum unknown in CRS definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded ellps unknown in CRS definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +R=6371007.181 +units=m +no_defs +type=crs
4: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum unknown in CRS definition
sh: 1: awk: Permission denied
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded ellps unknown in CRS definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +R=6371007.181 +units=m +no_defs +type=crs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum unknown in CRS definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded ellps unknown in CRS definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +R=6371007.181 +units=m +no_defs +type=crs
4: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum unknown in CRS definition
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
There were 16 warnings (use warnings() to see them)
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
There were 28 warnings (use warnings() to see them)
sh: 1: awk: Permission denied

RGISTools documentation built on July 2, 2020, 3:58 a.m.