Skip to content

Commit

Permalink
fix #21
Browse files Browse the repository at this point in the history
  • Loading branch information
Tompalski committed Mar 19, 2024
1 parent fb9cd2a commit b51121f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions R/metrics_rumple.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ metrics_rumple <- function(x, y, z, pixel_size, zmin=NA) {
if(!is.na(zmin)) assert_is_a_number(zmin)
assert_all_are_positive(pixel_size)

if (!is.na(zmin)) {
filt<- z>zmin
x <- x[filt]
y <- y[filt]
z <- z[filt]
}

r <- NA_real_

if (length(z) > 2) {

D <- data.table::data.table(X=x, Y=y, Z=z)

if (!is.na(zmin)) D <- D[Z > zmin]
# if (!is.na(zmin)) D <- D[Z > zmin]#z <- z[z>zmin]

if(nrow(D)>0) {

Expand All @@ -44,11 +51,13 @@ metrics_rumple <- function(x, y, z, pixel_size, zmin=NA) {
D <- lidR::decimate_points(D, lidR::highest(pixel_size))

r <- lidR::rumple_index(x = D$X, y = D$Y, z = D$Z)

}

return(list(rumple=r))

}

return(list(rumple=r))

}


Expand Down

0 comments on commit b51121f

Please sign in to comment.