# laspy.compression module

## LazBackend

class laspy.compression.LazBackend(*values)

  Bases: `ILazBackend`, `Enum`

  Supported backends for reading and writing LAS/LAZ

  LazrsParallel = 0

    lazrs in multi-thread mode

  Lazrs = 1

    lazrs in single-thread mode

  Laszip = 2

    laszip backend

  is_available() → bool

    Returns true if the backend is available

  property supports_append: bool
  create_appender(dest: BinaryIO, header: LasHeader) → IPointAppender
  create_reader(source: Any, header: LasHeader, decompression_selection: DecompressionSelection | None = None) → IPointReader
  create_writer(dest: Any, header: LasHeader) → IPointWriter
  classmethod detect_available() → Tuple[LazBackend, ...]

    Returns a tuple containing the available backends in the current python environment

## DecompressionSelection

class laspy.compression.DecompressionSelection(*values)

  Bases: `IntFlag`

  Holds which fields to decompress or not.

  Only used for files with version >= 1.4 && point format id >= 6.

  Ignored on other cases.

  Each flag in the enum has a corresponding `decompress_$name` and `skip_$name` methods to easily create a selection.

      >>> import laspy
      >>> # Creating a selection that decompresses the base + z field
      >>> selection = laspy.DecompressionSelection.base().decompress_z()
      >>> selection.is_set(laspy.DecompressionSelection.Z)
      True
      >>> selection.is_set(laspy.DecompressionSelection.INTENSITY)
      False

      >>> # Creating a selection that decompresses all fields but the intensity
      >>> selection = laspy.DecompressionSelection.all().skip_intensity()
      >>> selection.is_set(laspy.DecompressionSelection.INTENSITY)
      False
      >>> selection.is_set(laspy.DecompressionSelection.Z)
      True

  Added in version 2.4.

  XY_RETURNS_CHANNEL = 1

    Flag to decompress x, y, return number, number of returns and scanner channel

  Z = 2

    Flag to decompress z

  CLASSIFICATION = 4

    Flag to decompress the classification

  FLAGS = 8

    Flag to decompress the classification flags (withheld, key point, overlap, etc)

  INTENSITY = 16

    Flag to decompress the intensity

  SCAN_ANGLE = 32

    Flag to decompress the scan angle

  USER_DATA = 64

    Flag to decompress the user data

  POINT_SOURCE_ID = 128

    Flag to decompress the point source id

  GPS_TIME = 256

    Flag to decompress the gps time

  RGB = 512

    Flag to decompress the red, green, blue

  NIR = 1024

    Flag to decompress the nir

  WAVEPACKET = 2048

    Flag to decompress the wavepacket

  ALL_EXTRA_BYTES = 4096

    Flag to decompress all the extra bytes

  classmethod all() → DecompressionSelection

    Returns a selection where all fields will be decompressed

  classmethod base() → DecompressionSelection

    Returns a decompression selection where only the base x, y, return number, number of returns and scanner channel will be decompressed

  classmethod xy_returns_channel() → DecompressionSelection

    Returns a decompression selection where only the base x, y, return number, number of returns and scanner channel will be decompressed

  to_lazrs() → lazrs.DecompressionSelection
  to_laszip() → int
  is_set(mask) → bool
  decompress_all_extra_bytes()
  skip_all_extra_bytes()
  is_set_all_extra_bytes()
  decompress_classification()
  skip_classification()
  is_set_classification()
  decompress_flags()
  skip_flags()
  is_set_flags()
  decompress_gps_time()
  skip_gps_time()
  is_set_gps_time()
  decompress_intensity()
  skip_intensity()
  is_set_intensity()
  decompress_nir()
  skip_nir()
  is_set_nir()
  decompress_point_source_id()
  skip_point_source_id()
  is_set_point_source_id()
  decompress_rgb()
  skip_rgb()
  is_set_rgb()
  decompress_scan_angle()
  skip_scan_angle()
  is_set_scan_angle()
  decompress_user_data()
  skip_user_data()
  is_set_user_data()
  decompress_wavepacket()
  skip_wavepacket()
  is_set_wavepacket()
  decompress_xy_returns_channel()
  skip_xy_returns_channel()
  is_set_xy_returns_channel()
  decompress_z()
  skip_z()
  is_set_z()