Learn R Programming

rcaiman (version 1.2.2)

calc_co: Calculate canopy openness

Description

Calculate canopy openness

Usage

calc_co(bin, m = NULL, z, a, angle_width)

Value

Numeric vector of length one.

Arguments

bin

SpatRaster. Binarized hemispherical canopy image.

m

SpatRaster. A mask. For hemispherical photographs, check mask_hs().

z

SpatRaster built with zenith_image().

a

SpatRaster built with azimuth_image().

angle_width

Numeric vector of length one. It should be 30, 15, 10, 7.5, 6, 5, 3.75, 3, 2.5, 1.875, 1 or 0.5 degrees. This constrain is rooted in the requirement of a value able to divide both the 0 to 360 and 0 to 90 ranges into a whole number of segments.

Details

Canopy openness calculated as in the equation from Gonsamo2011;textualrcaiman:

\(CO = \sum_{i = 1}^{N} GF(\phi_i, \theta_i) \cdot [(cos(\theta_1) - cos(\theta_2))/n]\),

where \(GF(\phi_i, \theta_i)\) is the gap fraction of the cell \(i\), \(\theta_1\) and \(\theta_2\) are the minimum and maximum zenith angle of the cell \(i\), \(n\) is the number of cells on the ring delimited by \(\theta_1\) and \(\theta_2\), and \(N\) is the total number of cells.

When a mask is provided through the m argument, the equation is modified as follow:

\( \frac{ CO = \sum_{i = 1}^{N} GF(\phi_i, \theta_i) \cdot [(cos(\theta_1) - cos(\theta_2))/n] }{ \sum_{i = 1}^{N} (cos(\theta_1) - cos(\theta_2))/n} \).

This allows the masking of any individual cell.

References

Examples

Run this code
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- mask_hs(z, 0, 70)
bin <- apply_thr(caim$Blue, thr_isodata(caim$Blue[m]))
plot(bin)
calc_co(bin, m, z, a, 10)

Run the code above in your browser using DataLab