Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculation of pulse, point density off? #784

Open
Silviculturalist opened this issue Oct 9, 2024 · 2 comments
Open

Calculation of pulse, point density off? #784

Silviculturalist opened this issue Oct 9, 2024 · 2 comments

Comments

@Silviculturalist
Copy link

Silviculturalist commented Oct 9, 2024

Is it expected that the calculation of the pulse, point density / m**2 does not align with the manual calculation?

library(lidR)
LASfile = system.file("extdata","example.laz",package='rlas')
las = readLAS(LASfile)
las = retrieve_pulses(las)
summary(las)

my_metrics <- function(pulseID)
{
  return(list(nPulses = length(unique(pulseID))))
}

result = cloud_metrics(las,~my_metrics(pulseID))
result$nPulses/area(las)

summary(las) provides pulse density as 2.63 pulses/m2 whereas manual calculation gives 2.83?

@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Oct 9, 2024

The summary looks only at pre-computed number of first return while retrieve_pulse used the gpstime attribute in order to compute the exact pulse ID of each point. This way if you have a 2nd or 3rd return only without the first one (e.g. on the edge of the dataset) you still get a pulse.

The difference should be minimal in most cases but here you chose an extraordinary tiny dataset (30 points) where a single point difference can change a lot the final value.

@Silviculturalist
Copy link
Author

Yes, difference is minimal, noticed some decimal differences on my real dataset.
Small dataset here only as reprex.
Maybe it can be clarified in your documentation for summary function ?

Something like - # pulses, first return only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants