# laspy.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

laspy.point.record.scale_dimension(array_dim, scale, offset)

laspy.point.record.unscale_dimension(array_dim, scale, offset)

class laspy.point.record.DimensionNameValidity(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `Enum`

  Helper class to make the return value of PackedPointRecord.validate_dimentsion_name more expressive.

  Valid = 1
  Unsupported = 2
  Invalid = 3

class laspy.point.record.PackedPointRecord(data: ndarray, point_format: PointFormat)

  Bases: `object`

  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

      >>> #return number is a sub-field
      >>> from laspy import PointFormat, PackedPointRecord
      >>> packed_point_record = PackedPointRecord.zeros(10,PointFormat(0))
      >>> return_number = packed_point_record['return_number']
      >>> return_number
      <SubFieldView([0 0 0 0 0 0 0 0 0 0])>
      >>> return_number[:] = 1
      >>> bool(np.all(packed_point_record['return_number'] == 1))
      True

  property point_size

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

    Returns:

      The point size in byte

    Return type:

      int

  static zeros(point_count, point_format)

    Creates a new point record with all dimensions initialized to zero

    Parameters:

      - point_format (PointFormat) – The point format id the point record should have

      - point_count (int) – The number of point the point record should have

    Return type:

      PackedPointRecord

  static empty(point_format)

    Creates an empty point record.

    Parameters:

      point_format (laspy.PointFormat) – The point format id the point record should have

    Return type:

      PackedPointRecord

  classmethod from_point_record(other_point_record: PackedPointRecord, new_point_format: PointFormat) → PackedPointRecord

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

  classmethod from_buffer(buffer, point_format, count=-1, offset=0)
  copy_fields_from(other_record: PackedPointRecord) → None

    Tries to copy the values of the current dimensions from other_record

  copy() → PackedPointRecord
  memoryview() → memoryview
  resize(new_size: int) → None
  validate_dimension_name(key: str) → DimensionNameValidity

    Given a name of a dimension this validates it.

laspy.point.record.apply_new_scaling(record, scales: ndarray, offsets: ndarray) → None

class laspy.point.record.ScaleAwarePointRecord(array, point_format, scales, offsets)

  Bases: `PackedPointRecord`

  A ScaleAwarePointRecord is a point record that knows the scales and offets to use, and is thus able to get and set the scaled x, y, z coordinates

  To create one, use `ScaleAwarePointRecord.zeros()` or `ScaleAwarePointRecord.empty()`

  static zeros(point_count, *, point_format=None, scales=None, offsets=None, header=None)

    Creates a new point record with all dimensions initialized to zero

    Examples

        >>> record = ScaleAwarePointRecord.zeros(
        ... 5, point_format=PointFormat(3), scales=[1.0, 1.0, 1.0], offsets=[0.1, 0.5, 17.5])
        >>> len(record)
        5

        >>> import laspy
        >>> hdr = laspy.LasHeader()
        >>> record = ScaleAwarePointRecord.zeros(5, header=hdr)
        >>> len(record)
        5

        >>> hdr = laspy.LasHeader()
        >>> record = ScaleAwarePointRecord.zeros(5, header=hdr, scales=[1.0, 1.0, 1.0])
        Traceback (most recent call last):
        ValueError: header argument is mutually exclusive with point_format, scales and offets

        >>> record = ScaleAwarePointRecord.zeros(5, point_format=PointFormat(3))
        Traceback (most recent call last):
        ValueError: You have to provide all 3: point_format, scale and offsets

  static empty(point_format=None, scales=None, offsets=None, header=None)

    Creates an empty point record.

  change_scaling(scales=None, offsets=None) → None

    See `LasData.change_scaling()`