Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def lazrs_decompress_buffer(compressed_buffer, point_size, point_count, laszip_vlr, parallel=True):
try:
import lazrs
except Exception as e:
raise LazError("lazrs is not installed") from e
try:
point_compressed = np.frombuffer(compressed_buffer, dtype=np.uint8)
vlr_data = np.frombuffer(laszip_vlr.record_data, dtype=np.uint8)
point_decompressed = np.zeros(point_count * point_size, np.uint8)
lazrs.decompress_points(point_compressed, vlr_data, point_decompressed, parallel)
except lazrs.LazrsError as e:
raise LazError("lazrs error: {}".format(e)) from e
else:
return point_decompressed