r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
614 stars 134 forks source link

fix gap_fraction_profile and LAD for one layer profile #719

Closed floriandeboissieu closed 1 year ago

floriandeboissieu commented 1 year ago

Hi Jean-Romain, In commit Fix LAD if not computable you added a few lines to return a 0 row data.frame when there is two layers or less for LAD.

I do not see the reason for that: a unique layer with points inside (and eventually below) should still give a gap fraction and thus a LAD, no?

In that pull-request, I made the changes to do so: in LAD() I only returned a 0 row data.frame when gap_fraction_profile was returning a 0 row data.frame.

By the way, I simplified several things in gap_fraction_profile(), with the gap fraction being the gf=N_out/N_in:

I hope I did not missed anything.

Jean-Romain commented 1 year ago

Sorry I forgot about that one. It sounds good thank you.