Skip to contents

Computes metrics for a list of LAS objects (should be normalized point clouds). Calls the function cloud_metrics on each element and then arranges the results in a data.frame.

Usage

clouds_metrics(
  llasn,
  func = ~lidR::stdmetrics(X, Y, Z, Intensity, ReturnNumber, Classification, dz = 1)
)

Arguments

llasn

list of LAS objects

func

function. function applied on each element to compute metrics, default function is stdmetrics from package lidR

Value

A data frame with metrics in columns corresponding to LAS objects of the list (lines)

Examples

# load LAS file
LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee")
las_chablais3 <- lidR::readLAS(LASfile)
#> 
                                                                                


# set number of threads
lidR::set_lidr_threads(2)
# extract four point clouds from LAS object
llas <- list()
llas[["A"]] <- lidR::clip_circle(las_chablais3, 974350, 6581680, 10)
llas[["B"]] <- lidR::clip_circle(las_chablais3, 974390, 6581680, 10)
llas[["C"]] <- lidR::clip_circle(las_chablais3, 974350, 6581640, 10)
# normalize point clouds
llas <- lapply(llas, function(x) {
  lidR::normalize_height(x, lidR::tin())
})

# compute metrics
clouds_metrics(llas)
#>    zmax     zmean      zsd       zskew    zkurt zentropy pzabovezmean pzabove2
#> A 24.97  8.200378 6.653057  0.24594664 1.961543       NA     49.97394 70.47942
#> B 29.92 10.728430 8.675175  0.10653664 1.698623       NA     51.75705 70.10846
#> C 24.80  9.143980 7.063444 -0.01263106 1.743275       NA     56.02694 70.12346
#>   zq5 zq10 zq15 zq20 zq25  zq30   zq35  zq40 zq45  zq50  zq55   zq60   zq65
#> A   0 0.01 0.08 0.14 0.26 2.330 4.8980 6.298 7.36  8.20  9.07  9.972 11.230
#> B   0 0.00 0.07 0.14 0.31 2.050 5.4905 8.270 9.55 11.24 12.91 13.940 15.427
#> C   0 0.00 0.06 0.11 0.19 2.182 5.8970 8.060 9.48 10.46 11.27 12.090 12.790
#>     zq70   zq75   zq80    zq85  zq90    zq95   zpcum1   zpcum2   zpcum3
#> A 12.429 13.480 14.626 15.7645 17.28 19.3715 22.72727 28.08338 39.80892
#> B 16.836 18.260 19.482 20.5400 22.14 23.8900 24.40331 27.44764 35.84998
#> C 13.480 14.475 15.620 16.9200 18.53 20.2130 21.66202 25.38637 29.76945
#>     zpcum4   zpcum5   zpcum6   zpcum7   zpcum8   zpcum9   itot imax    imean
#> A 55.64563 66.93688 79.24146 89.77997 95.57035 98.78402 199563  241 51.99661
#> B 46.12762 59.42523 70.55528 85.26547 94.56892 97.75938 304385  329 66.02711
#> C 39.95440 57.13200 73.90423 85.05194 93.41272 98.70788 258633  344 58.05455
#>        isd    iskew    ikurt ipground ipcumzq10 ipcumzq30 ipcumzq50 ipcumzq70
#> A 44.55413 1.541006 4.837381 16.74709  16.97459  43.74208  60.48416  76.95214
#> B 57.87155 1.377143 4.296114 17.19566  17.34218  42.78102  58.76932  75.23827
#> C 53.03977 1.628797 5.320817 20.75528  20.81946  43.03936  59.43402  76.95344
#>   ipcumzq90     p1th     p2th p3th p4th p5th  pground    n     area
#> A  92.40440 72.14695 27.85305    0    0    0  9.84888 3838 394.6170
#> B  92.37019 69.82646 30.17354    0    0    0 10.80260 4610 395.8090
#> C  92.49168 70.54994 29.45006    0    0    0 11.26824 4455 396.8039

# compute metrics with user-defined function
# mean and standard deviation of first return points above 10 m
user_func <- function(z, rn, hmin = 10) {
  # first return above hmin subset
  dummy <- which(z >= hmin & rn == 1)
  return(list(
    mean.z = mean(z[dummy]),
    sd.z = stats::sd(z[z > hmin])
  ))
}
clouds_metrics(llas, func = ~ user_func(Z, ReturnNumber, 10))
#> Error in user_func(Z, ReturnNumber, 10): could not find function "user_func"