Learn R Programming

rGEDI (version 0.6.0)

polyStatsLevel2BVPM: Compute descriptive statistics of GEDI Canopy Cover and Vertical Profile Metrics

Description

Computes a Series of Statistics of GEDI derived Canopy Cover and Vertical Profile metrics within a given area defined or not by a polygon

Usage

polyStatsLevel2BVPM(level2BVPM, func, id=NULL)

Value

Returns an S4 object of class data.table::data.table

Containing Statistics of GEDI level2BVPM defined metrics

Arguments

level2BVPM

A GEDI Level2BVPM object (output of getLevel2BVPM() function). An S4 object of class "data.table".

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

See Also

Examples

Run this code
# 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)

Run the code above in your browser using DataLab