ubarsc / pylidar

A set of Python modules which makes it easy to write lidar processing code in Python
http://www.pylidar.org
GNU General Public License v3.0
15 stars 11 forks source link

spdv4 NUMBER_OF_POINTS as float64 #5

Closed gillins closed 8 years ago

gillins commented 8 years ago

Original report by Neil Flood (Bitbucket: neilflood, GitHub: neilflood).


Somewhere in the conversion from a Riegl rxp file to an SPD V4 file, the NUMBER_OF_POINTS gets converted to a float64. This is likely to be problematic. It is defined in the format as uint64, and so this means that at some point in the process, there is an implicit type conversion going on. This is unlikely to be handling precision in the right ways, and I suspect it responsible for a loss of precision when the number of points is large. The same type conversion appears to also occur in conversion from .las to SPD V4. NUMBER_OF_PULSES also appears to undergo the same type conversion.

gillins commented 8 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


Check commit 7c2e1a0.

Turns out that adding a numpy.uint64 to an int results in a numpy.float64 which is a bit weird. Anyway this seems to fix it for me - let me know if this fixes the total-number-of problem.

gillins commented 8 years ago

Original comment by Neil Flood (Bitbucket: neilflood, GitHub: neilflood).


Thanks Sam. Yes, that was it. Weird. That fixes the problem of the NUMBER_OF_POINTS field suddenly turning into a float, which is good. Sadly, this does not in turn fix the mysterious problem of the number of points changing slightly when after running through pylidar_index, so apparently this is a separate question. I don't even know for certain that it is a problem, but it would be nice to know why that happens. Anyway, this issue is fixed, so I am closing it off.