0

In R lidR package, when I run lasfilterdecimate with the homogenize option excluding use_pulse = TRUE it works, but when I include use_pulse = TRUE, it does not work.

For example, the code below does not work:

currenttilethinned <- lasfilterdecimate(currenttilepulse,homogenize(density,res=20,**use_pulse = TRUE**))

The code below works, but I am not sure if it is filtering by pulse (laspulse has already been run on the input LAS file, currenttilepulse):

currenttilethinned <- lasfilterdecimate(currenttilepulse,homogenize(4.25,res=20))

Does homogenize automatically use the pulses when pulseID is present?

1

I was prompted to have a look closer at the GPS time stamps which the code uses to assign pulse IDs and then thin when use_pulse=TRUE. Out of my 5,000+ tiles, it turns out a few tiles had the GPS time stamps removed from the whole tile and thus, wasn't thinning because it only assigned one pulse for the whole tile (4+million points!).

I ended up writing a function that wrote out the number of points, number of pulses for each tile which identified which ones had this problem:

CheckPulses <- function(path, density, start_file=1){
  lasfiles <- list.files(path, pattern = "\\.laz$",full.names=TRUE)
  df = data.table(tileID=rep(NA,length(lasfiles)),npoints=NA,npulse=NA)
  for(i in start_file:length(lasfiles)){
    tilename <- basename(lasfiles[i])[[1]]
    currenttile <- readLAS(lasfiles[i])
    currenttilepulse <- laspulse(currenttile)
    df$tileID[i] = tilename
    df$npoints[i] = nrow(currenttile@data)
    df$npulse[i] = length(unique(currenttilepulse@data$pulseID))
  }
  return(df)
}
  • 1
    Thank you for feed back. So everything is ok but it deserves a warning in function laspulse. – JRR Apr 21 at 11:25
  • @JRR I think a warning would be a great addition! Something to prompt the user that the whole input has only one pulse. Thanks for the prompt communication! – Mel Apr 25 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.