Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
Merge branch 'fixes/ignore-extra-bytes-vlr'
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Mar 10, 2020
2 parents 84a4484 + d124507 commit fa2f032
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pylas/lasreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .compression import lazrs_decompress_buffer, lazperf_decompress_buffer, LasZipProcess
from .lasdatas import las14, las12
from .point import record, PointFormat
from .point.dims import size_of_point_format_id
from .utils import ConveyorThread
from .vlrs import rawvlr
from .vlrs.vlrlist import VLRList
Expand Down Expand Up @@ -108,6 +109,13 @@ def _read_points(self, vlrs):
except IndexError:
extra_dims = None

point_size_without_extra_bytes = size_of_point_format_id(self.header.point_format_id)
if extra_dims is not None and self.header.point_size == point_size_without_extra_bytes:
logger.warning("There is an ExtraByteVlr but the header.point_size matches the "
"point size without extra bytes. The extrabytes vlr info will be ignored")
vlrs.extract("ExtraBytesVlr")
extra_dims = None

point_format = PointFormat(self.header.point_format_id, extra_dims=extra_dims)
if self.header.are_points_compressed:
laszip_vlr = vlrs.pop(vlrs.index("LasZipVlr"))
Expand Down
7 changes: 7 additions & 0 deletions pylas/point/dims.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ def np_dtype_to_point_format(dtype, unpacked=False):
)


def size_of_point_format_id(point_format_id):
try:
return ALL_POINT_FORMATS_DTYPE[point_format_id].itemsize
except KeyError:
raise errors.PointFormatNotSupported(point_format_id)


def min_file_version_for_point_format(point_format_id):
""" Returns the minimum file version that supports the given point_format_id
"""
Expand Down

0 comments on commit fa2f032

Please sign in to comment.