A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/r-lidar/lidR/issues/609 below:

Error using `by_echo` for echo type "lastofmany" · Issue #609 · r-lidar/lidR · GitHub

When using by_echo in any of the _metrics() functions the metrics calculated for the lastofmany echoes are NA.

Here is an example using some functions:

LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las <- readLAS(LASfile, filter = "-keep_random_fraction 0.5")

echo = c("all", "first", "intermediate", "lastofmany", "single", "multiple")

# ================
# CLOUD METRICS
# ================

m = cloud_metrics(las, .stdmetrics_z, by_echo = echo)

col = names(m)[grepl("zmax", names(m))]
unlist(m[col])
#>   zmax        zmax.first zmax.intermediate   zmax.lastofmany       zmax.single     zmax.multiple 
#>  29.97             29.97             24.01                NA             29.97             28.56 

# ================
# PIXEL METRICS
# ================

m <- pixel_metrics(las, .stdmetrics_z, 20, by_echo = echo)

col = names(m)[grepl("zmax", names(m))]
unlist(m[col])
#>     class       : SpatRaster 
#>     dimensions  : 13, 12, 6  (nrow, ncol, nlyr)
#>     resolution  : 20, 20  (x, y)
#>     extent      : 684760, 685000, 5017760, 5018020  (xmin, xmax, ymin, ymax)
#>     coord. ref. : NAD83 / UTM zone 17N (EPSG:26917) 
#>     sources     : memory  
#>                   memory  
#>                   memory  
#>                 ... and 3 more source(s)
#>     names       :  zmax, zmax.first, zmax.~diate, zmax.~fmany, zmax.single, zmax.~tiple 
#>     min values  :  0.00,       0.00,        5.36,         NaN,        0.00,       10.88 
#>     max values  : 29.97,      29.97,       24.01,         NaN,       29.97,       28.56 

# ================
# PLOT METRICS
# ================

shpfile <- system.file("extdata", "efi_plot.shp", package="lidR")
inventory <- sf::st_read(shpfile, quiet = TRUE)

m <- plot_metrics(las, .stdmetrics_z, inventory, radius = 11.28,by_echo = echo)

col = names(m)[grepl("zmax", names(m))]
summary(m[,col])
#>        zmax         zmax.first    zmax.intermediate zmax.lastofmany  zmax.single    zmax.multiple            geometry
#>   Min.   :21.61   Min.   :21.61   Min.   :14.92     Min.   : NA     Min.   :21.15   Min.   :21.61   POINT        :5  
#>    1st Qu.:25.26   1st Qu.:25.26   1st Qu.:18.26     1st Qu.: NA     1st Qu.:25.26   1st Qu.:23.25   epsg:26917   :0  
#>    Median :25.26   Median :25.26   Median :19.05     Median : NA     Median :25.26   Median :24.60   +proj=utm ...:0  
#>    Mean   :24.84   Mean   :24.84   Mean   :18.71     Mean   :NaN     Mean   :24.73   Mean   :24.13                    
#>    3rd Qu.:25.89   3rd Qu.:25.89   3rd Qu.:20.41     3rd Qu.: NA     3rd Qu.:25.89   3rd Qu.:25.03                    
#>    Max.   :26.18   Max.   :26.18   Max.   :20.89     Max.   : NA     Max.   :26.11   Max.   :26.18   NA's   :5                                                        

# ================
# CROWN METRICS
# ================

# Already tree-segmented point cloud
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
trees <- readLAS(LASfile, filter = "-drop_z_below 0")

metrics <- crown_metrics(trees, .stdtreemetrics, by_echo = echo)

col = names(metrics)[grepl("Z.", names(metrics))]
summary(metrics[,col]) # Here also "intermediate" echoes return NA metrics
#>       Z.first      Z.intermediate  Z.lastofmany    Z.single       Z.multiple             geometry  
#>    Min.   : 2.76   Min.   : NA    Min.   : NA   Min.   : 2.76   Min.   : 4.24   POINT Z      :200  
#>    1st Qu.:19.09   1st Qu.: NA    1st Qu.: NA   1st Qu.:18.80   1st Qu.:17.42   epsg:26912   :  0  
#>    Median :21.59   Median : NA    Median : NA   Median :21.55   Median :20.41   +proj=utm ...:  0  
#>    Mean   :21.03   Mean   :NaN    Mean   :NaN   Mean   :20.90   Mean   :19.86                      
#>    3rd Qu.:24.08   3rd Qu.: NA    3rd Qu.: NA   3rd Qu.:24.08   3rd Qu.:22.62                      
#>    Max.   :32.07   Max.   : NA    Max.   : NA   Max.   :32.07   Max.   :31.94                      
#>                   NA's   :200    NA's   :200                   NA's   :2                          

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4