pylas.point.record module

Contains the classes that manages Las PointRecords Las PointRecords are represented using Numpy’s structured arrays, The PointRecord classes provide a few extra things to manage these arrays in the context of Las point data

class pylas.point.record.IPointRecord[source]

Bases: abc.ABC

Wraps the numpy structured array contained the points data

actual_point_size

Shall return the actual size in bytes that ta points take in memory

classmethod empty(point_format_id)[source]
classmethod from_stream(stream, point_format_id, count)[source]
point_size

Shall return the point size as that will be written in the header

raw_bytes()[source]
write_to(out)[source]
class pylas.point.record.PackedPointRecord(data, point_format=None)[source]

Bases: pylas.point.record.PointRecord

In the PackedPointRecord, fields that are a combinations of many sub-fields (fields stored on less than a byte) are still packed together and are only de-packed and re-packed when accessed.

This uses of less memory than if the sub-fields were unpacked However some operations on sub-fields require extra steps:

>>> #return number is a sub-field
>>> from pylas import PointFormat
>>> packed_point_record = PackedPointRecord.zeros(PointFormat(0), 10)
>>> packed_point_record['return_number'][:] = 1
>>> np.alltrue(packed_point_record == 1)
False
>>> packed_point_record = PackedPointRecord.zeros(PointFormat(0), 10)
>>> rn = packed_point_record['return_number']
>>> rn[:] = 1
>>> packed_point_record['return_number'] = rn
>>> np.alltrue(packed_point_record['return_number'] == 1)
True
all_dimensions_names

Returns all the dimensions names, including the names of sub_fields and their corresponding packed fields

classmethod empty(point_format)[source]

Creates an empty point record.

Parameters:point_format (pylas.PointFormat) – The point format id the point record should have
Returns:
Return type:PackedPointRecord
classmethod from_buffer(buffer, point_format, count, offset=0)[source]
classmethod from_stream(stream, point_format, count)[source]

Construct the point record by reading the points from the stream

point_size

Returns the point size in bytes taken by each points of the record

Returns:The point size in byte
Return type:int
to_unpacked()[source]
write_to(out)[source]

Writes the points to the output stream

classmethod zeros(point_format, point_count)[source]

Creates a new point record with all dimensions initialized to zero

Parameters:
  • point_format_id (int) – The point format id the point record should have
  • point_count (int) – The number of point the point record should have
Returns:

Return type:

PackedPointRecord

class pylas.point.record.PointRecord(data, point_format: pylas.point.format.PointFormat)[source]

Bases: pylas.point.record.IPointRecord

actual_point_size

Returns the point size in bytes taken by each points of the record

Returns:The point size in byte
Return type:int
add_extra_dims(type_tuples)[source]
copy_fields_from(other_record)[source]

Tries to copy the values of the current dimensions from other_record

dimensions_names
extra_dimensions_names

Returns the names of extra-dimensions contained in the PointRecord

classmethod from_point_record(other_point_record, new_point_format)[source]

Construct a new PackedPointRecord from an existing one with the ability to change to point format while doing so

memoryview()[source]
raw_bytes()[source]
class pylas.point.record.UnpackedPointRecord(data, point_fmt_id=None)[source]

Bases: pylas.point.record.PointRecord

In the Unpacked Point Record, all the sub-fields are un-packed meaning that they are in their own array. Because the minimum size for the elements of an array is 8 bits, and sub-fields are only a few bits (less than 8) the resulting unpacked array uses more memory, especially if the point format has lots of sub-fields

classmethod empty(point_format)[source]
classmethod from_compressed_buffer(compressed_buffer, point_format_id, count, laszip_vlr)[source]
classmethod from_stream(stream, point_format_id, count, extra_dims=None)[source]
point_size

Shall return the point size as that will be written in the header

to_packed()[source]
write_to(out)[source]
pylas.point.record.raise_not_enough_bytes_error(expected_bytes_len, missing_bytes_len, point_data_buffer_len, points_dtype)[source]