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/463 below:

Conversion to type double when integer is too big in stdmetrics · Issue #463 · r-lidar/lidR · GitHub

Hello Jean-Romain,

Thank you for the very useful and powerful package lidR. I have been using it for some months now and I am trying to compute standard metrics using the grid_metrics() function, with .stdmetrics as the func argument.

I am having an issue regarding the computation of the total intensity (itot, which is part of stdmetrics_i). The error message is about a column being of type double instead of integer. I copy the error message here for information :

"Error in `[.data.table`(las@data, , if (!anyNA(.BY)) c(eval(call)), by = cells) : 
  Column 1 of result for group 59 is type 'double' but expecting type 'integer'. Column types must be consistent for each group."

I have investigated the issue and it seems that the total intensity, which is defined as the sum of all the returns' intensities, reaches a too big value to be kept as an integer and is seen as a double by R. I tried to "manually" compute the sum of intensities using a custom function rather than .stdmetrics_i in grid_metrics(), and I got the same error. Then I added a conversion of the result as an integer using the as.integer64() function from the bit64 package (which allows conversion of "big" integers), and the issue was solved.

Is there a way to "force" stdmetrics_i to keep the itot result as an integer ? Since I'm computing grid_metrics() over a whole LAScatalog there are only a few chunks where itot is too big, but it ruins the whole computation. Thank you very much for your feedback !


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