View source: R/polyStatsLevel2BVPM.R
| polyStatsLevel2BVPM | R Documentation |
Computes a Series of Statistics of GEDI derived Canopy Cover and Vertical Profile metrics within a given area defined or not by a polygon
polyStatsLevel2BVPM(level2BVPM, func, id=NULL)
level2BVPM |
A GEDI Level2BVPM object (output of |
func |
The function to be applied for computing the defined statistics |
id |
A vector containing the polygon id for each GEDI observation. Default is NULL |
Returns an S4 object of class data.table::data.table Containing Statistics of GEDI level2BVPM defined metrics
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# A small extracted Level 2B table
level2BVPM <- data.table::data.table(
pai = c(1.1, 1.8, 2.2, 0.9, 1.5, 2.4),
cover = c(0.31, 0.44, 0.52, 0.27, 0.39, 0.58),
poly_id = rep(c("stand_1", "stand_2"), each = 3)
)
head(level2BVPM)
# Define your own function
mySetOfMetrics <- function(x) {
metrics <- list(
min = min(x), # Min of x
max = max(x), # Max of x
mean = mean(x), # Mean of x
sd = sd(x) # Sd of x
)
return(metrics)
}
# Computing the max of the Total Plant Area Index
pai_max <- polyStatsLevel2BVPM(level2BVPM, func = max(pai), id = NULL)
pai_max
# Computing the max of the Total Plant Area Index stratified by polygon
pai_max_poly <- polyStatsLevel2BVPM(level2BVPM, func = max(pai), id = "poly_id")
head(pai_max_poly)
# Computing the serie of statistics of canopy cover stratified by polygon
cover_metrics <- polyStatsLevel2BVPM(level2BVPM,
func = mySetOfMetrics(cover),
id = "poly_id"
)
head(cover_metrics)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.