Canopy openness is computed following the equation from
Gonsamo2011;textualrcaiman:
$$
CO = \sum_{i = 1}^{N} GF(\phi_i, \theta_i) \cdot \frac{\cos(\theta_{1,i}) -
\cos(\theta_{2,i})}{n_i}
$$
where \(GF(\phi_i, \theta_i)\) is the gap fraction in cell \(i\),
\(\theta_{1,i}\) and \(\theta_{2,i}\) are the lower and upper zenith
angles of the cell, \(n_i\) is the number of cells in the corresponding
zenith ring, and \(N\) is the total number of cells.
When a mask is provided via the m argument, the equation is adjusted to
compensate for the reduced area of the sky vault:
$$
CO = \frac{\sum_{i=1}^{N} GF(\phi_i, \theta_i) \cdot w_i}
{\sum_{i=1}^{N} w_i}
\quad \text{with} \quad
w_i = \frac{\cos(\theta_{1,i}) - \cos(\theta_{2,i})}{n_i}
$$
The denominator ensures that the resulting openness value remains
scale-independent. Without this normalization, masking would lead to
underestimation, as the numerator alone assumes full hemispherical coverage.