pylas.point.format module

class pylas.point.format.ExtraBytesParams(name: str, type: str, description: str = '', offsets: Optional[numpy.ndarray] = None, scales: Optional[numpy.ndarray] = None)[source]

Bases: object

All parameters needed to create extra bytes

name = None

The name of the extra dimension

type = None

The type of the extra dimension

description = None

A description of the extra dimension

offsets = None

The offsets to use if its a ‘scaled dimension’, can be none

scales = None

The scales to use if its a ‘scaled dimension’, can be none

class pylas.point.format.PointFormat(point_format_id: int)[source]

Bases: object

Class that contains the informations about the dimensions that forms a PointFormat.

A PointFormat has ‘standard’ dimensions (dimensions defined in the LAS standard, each point format has its set of dimensions), but it can also have extra (non-standard) dimensions defined by the user)

>>> fmt = PointFormat(3)
>>> all(dim.is_standard for dim in fmt.dimensions)
True
>>> dim = fmt.dimension_by_name("classification") # or fmt["classification"]
>>> dim.max
31
>>> dim.min
0
>>> dim.num_bits
5
standard_dimensions

Returns an iterable of the standard dimensions

>>> fmt = PointFormat(0)
>>> standard_dims = list(fmt.standard_dimensions)
>>> len(standard_dims)
15
>>> standard_dims[4].name
'return_number'
extra_dimensions
dimension_names

Returns the names of the dimensions contained in the point format

standard_dimension_names

Returns the names of the extra dimensions in this point format

extra_dimension_names

Returns the names of the extra dimensions in this point format

size

Returns the number of bytes (standard + extra) a point takes

>>> PointFormat(3).size
34
>>> fmt = PointFormat(3)
>>> fmt.add_extra_dimension(ExtraBytesParams("codification", "uint64"))
>>> fmt.size
42
num_standard_bytes

Returns the number of bytes used by standard dims

>>> fmt = PointFormat(3)
>>> fmt.add_extra_dimension(ExtraBytesParams("codification", "uint64"))
>>> fmt.num_standard_bytes
34
num_extra_bytes

Returns the number of extra bytes

>>> fmt = PointFormat(3)
>>> fmt.add_extra_dimension(ExtraBytesParams("codification", "uint64"))
>>> fmt.num_extra_bytes
8
has_waveform_packet

Returns True if the point format has waveform packet dimensions

dimension_by_name(name: str) → pylas.point.dims.DimensionInfo[source]

Returns the dimension info for the dimension by name

ValueError is raised if the dimension does not exist un the point format

>>> info = PointFormat(2).dimension_by_name('number_of_returns')
>>> info.name == 'number_of_returns'
True
>>> info.num_bits == 3
True
>>> info = PointFormat(2).dimension_by_name('gps_time')
Traceback (most recent call last):
...
ValueError: Dimension 'gps_time' does not exist
add_extra_dimension(param: pylas.point.format.ExtraBytesParams) → None[source]

Add an extra, user-defined dimension

dtype()[source]

Returns the numpy.dtype used to store the point records in a numpy array

Note

The dtype corresponds to the dtype with sub_fields packed into their composed fields

pylas.point.format.lost_dimensions(point_fmt_in, point_fmt_out)[source]

Returns a list of the names of the dimensions that will be lost when converting from point_fmt_in to point_fmt_out