[GIS] laspy ValueError: buffer size must be a multiple of element size

fusionlaslaspylidarpython-2.7

I am trying to learn LASPY and am running into road blocks off the bat. I first ran into and Error 8 (Not enough storage is available to process this command) using my full sized LAS file (1.7GB). I was able to get around it by using FUSION's polyclipdata to create multiple smaller sized LAS files; just frustrating. The second road block I have run into, and I can't find out much about it, is:

ValueError: buffer size must be a multiple of element size

when I try:

import laspy
import numpy as np
from laspy import file
infile = file.File("F:/P834/temp/pointfile3_2.las", mode="r")

Error occurs on line 4.

I am trying to work through the tutorial http://laspy.readthedocs.io/en/latest/tut_part_1.html

What am I missing in my early start?

Full error printout:

Traceback (most recent call last):
  File "F:/P834/laspy/laspy_tests.py", line 2, in <module>
    infile = laspy.file.File('F:/P834/temp/pointfile3_2.las', mode='r')
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\file.py", line 64, in __init__
    self.open()
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\file.py", line 75, in open
    self._reader = base.Reader(self.filename, mode=self._mode)
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\base.py", line 273, in __init__
    self.setup_read_write(vlrs,evlrs, read_only=True)
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\base.py", line 321, in setup_read_write
    self.data_provider.point_map()
  File "C:\Python27\ArcGIS10.3\lib\site-packages\laspy\base.py", line 163, in point_map
    offset=self.manager.header.data_offset)
ValueError: buffer size must be a multiple of element size

Best Answer

As determined while working through the problem with Aaron, I figured out I was working with corrupt data, because applying the same code to other .las file worked (here is the alternative file used).

I have opened another question related to why FUSION is creating corrupt data when using the polyclipdata module here: FUSION polyclipdata creates corrupt LAS file

Related Question