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

Commit

Permalink
version 0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Oct 5, 2018
1 parent 28ad60b commit 658f667
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pylas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.3.3"
__version__ = "0.3.4"

from . import errors, vlrs
from .headers import HeaderFactory
Expand Down
29 changes: 20 additions & 9 deletions pylas/vlrs/known.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def parse_record_data(self, record_data):
for i in range(len(record_data) // ctypes.sizeof(ClassificationLookupStruct)):
self.lookups.append(
ClassificationLookupStruct.from_buffer_copy(
record_data[self._lookup_size * i : self._lookup_size * (i + 1)]
record_data[self._lookup_size * i: self._lookup_size * (i + 1)]
)
)

Expand Down Expand Up @@ -231,7 +231,7 @@ def parse_record_data(self, data):
self.extra_bytes_structs = [None] * num_extra_bytes_structs
for i in range(num_extra_bytes_structs):
self.extra_bytes_structs[i] = ExtraBytesStruct.from_buffer_copy(
data[ExtraBytesStruct.size() * i : ExtraBytesStruct.size() * (i + 1)]
data[ExtraBytesStruct.size() * i: ExtraBytesStruct.size() * (i + 1)]
)

def record_data_bytes(self):
Expand Down Expand Up @@ -358,25 +358,30 @@ def parse_record_data(self, record_data):
header_data = record_data[: ctypes.sizeof(GeoKeysHeaderStructs)]
self.geo_keys_header = GeoKeysHeaderStructs.from_buffer(header_data)
self.geo_keys = []
keys_data = record_data[GeoKeysHeaderStructs.size() :]
keys_data = record_data[GeoKeysHeaderStructs.size():]
num_keys = (
len(record_data[GeoKeysHeaderStructs.size() :]) // GeoKeyEntryStruct.size()
len(record_data[GeoKeysHeaderStructs.size():]) // GeoKeyEntryStruct.size()
)
if num_keys != self.geo_keys_header.number_of_keys:
# print("Mismatch num keys")
self.geo_keys_header.number_of_keys = num_keys

for i in range(self.geo_keys_header.number_of_keys):
data = keys_data[
(i * GeoKeyEntryStruct.size()) : (i + 1) * GeoKeyEntryStruct.size()
]
(i * GeoKeyEntryStruct.size()): (i + 1) * GeoKeyEntryStruct.size()
]
self.geo_keys.append(GeoKeyEntryStruct.from_buffer(data))

def record_data_bytes(self):
b = bytes(self.geo_keys_header)
b += b"".join(map(bytes, self.geo_keys))
return b

def __repr__(self):
return "<{}({} geo_keys)>".format(
self.__class__.__name__, len(self.geo_keys)
)

@staticmethod
def official_user_id():
return "LASF_Projection"
Expand All @@ -402,12 +407,15 @@ def parse_record_data(self, record_data):
record_data = bytearray(record_data)
num_doubles = len(record_data) // sizeof_double
for i in range(num_doubles):
b = record_data[i * sizeof_double : (i + 1) * sizeof_double]
b = record_data[i * sizeof_double: (i + 1) * sizeof_double]
self.doubles.append(ctypes.c_double.from_buffer(b))

def record_data_bytes(self):
return b"".join(map(bytes, self.doubles))

def __repr__(self):
return "<GeoDoubleParamsVlr({})>".format(self.doubles)

@staticmethod
def official_user_id():
return "LASF_Projection"
Expand All @@ -428,6 +436,9 @@ def parse_record_data(self, record_data):
def record_data_bytes(self):
return NULL_BYTE.join(s.encode("ascii") for s in self.strings)

def __repr__(self):
return "<GeoAsciiParamsVlr({})>".format(self.strings)

@staticmethod
def official_user_id():
return "LASF_Projection"
Expand Down Expand Up @@ -503,8 +514,8 @@ def vlr_factory(raw_vlr):
known_vlrs = BaseKnownVLR.__subclasses__()
for known_vlr in known_vlrs:
if (
known_vlr.official_user_id() == user_id
and raw_vlr.header.record_id in known_vlr.official_record_ids()
known_vlr.official_user_id() == user_id
and raw_vlr.header.record_id in known_vlr.official_record_ids()
):
return known_vlr.from_raw(raw_vlr)
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="pylas",
version="0.3.3",
version="0.3.4",
description="Las/Laz reading and writing in python",
long_description=readme,
url="https://github.com/tmontaigu/pylas",
Expand Down

0 comments on commit 658f667

Please sign in to comment.