pylas/lasreader.py
def read(self):
        """ Reads the whole las data (header, vlrs ,points, etc) and returns a LasData
        object
        """
        vlrs = self.read_vlrs()
        self._warn_if_not_at_expected_pos(
            self.header.offset_to_point_data, "end of vlrs", "start of points"
        )
        self.stream.seek(self.start_pos + self.header.offset_to_point_data)

        try:
            points = self._read_points(vlrs)
        except (RuntimeError, errors.LazPerfNotFound) as e:
            logger.error("LazPerf failed to decompress ({}), trying laszip.".format(e))
            self.stream.seek(self.start_pos)
            self.__init__(io.BytesIO(laszip_decompress(self.stream)))
            return self.read()

        if points.point_format.has_waveform_packet:
            self.stream.seek(
                self.start_pos + self.header.start_of_waveform_data_packet_record
            )
            if self.header.global_encoding.are_waveform_flag_equal():
                raise errors.PylasError(
                    "Incoherent values for internal and external waveform flags, both are {})".format(
                        "set"
                        if self.header.global_encoding.waveform_internal
                        else "unset"
                    )
                )
            if self.header.global_encoding.waveform_internal:
                # TODO: Find out what to do with these
                _, _ = self._read_internal_waveform_packet()
            elif self.header.global_encoding.waveform_external:
                logger.info(
                    "Waveform data is in an external file, you'll have to load it yourself"
                )

        if self.header.version >= "1.4":
            evlrs = self.read_evlrs()
            return las14.LasData(
                header=self.header, vlrs=vlrs, points=points, evlrs=evlrs
            )

        return las12.LasData(header=self.header, vlrs=vlrs, points=points)
def read(self):
        """ Reads the whole las data (header, vlrs ,points, etc) and returns a LasData
        object
        """
        vlrs = self.read_vlrs()
        self._warn_if_not_at_expected_pos(
            self.header.offset_to_point_data, "end of vlrs", "start of points"
        )
        self.stream.seek(self.start_pos + self.header.offset_to_point_data)

        try:
            points = self._read_points(vlrs)
        except (RuntimeError, errors.LazPerfNotFound) as e:
            logger.error("LazPerf failed to decompress ({}), trying laszip.".format(e))
            self.stream.seek(self.start_pos)
            self.__init__(io.BytesIO(laszip_decompress(self.stream)))
            return self.read()

        if points.point_format.has_waveform_packet:
            self.stream.seek(
                self.start_pos + self.header.start_of_waveform_data_packet_record
            )
            if self.header.global_encoding.are_waveform_flag_equal():
                raise errors.PylasError(
                    "Incoherent values for internal and external waveform flags, both are {})".format(
                        "set"
                        if self.header.global_encoding.waveform_internal
                        else "unset"
                    )
                )
            if self.header.global_encoding.waveform_internal:
                # TODO: Find out what to do with these
                _, _ = self._read_internal_waveform_packet()
            elif self.header.global_encoding.waveform_external:
                logger.info(
                    "Waveform data is in an external file, you'll have to load it yourself"
                )

        if self.header.version >= "1.4":
            evlrs = self.read_evlrs()
            return las14.LasData(
                header=self.header, vlrs=vlrs, points=points, evlrs=evlrs
            )

        return las12.LasData(header=self.header, vlrs=vlrs, points=points)
def read ( self ) : vlrs = self . read_vlrs ( ) self . _warn_if_not_at_expected_pos ( self . header . offset_to_point_data , "end of vlrs" , "start of points" ) self . stream . seek ( self . start_pos + self . header . offset_to_point_data ) try : points = self . _read_points ( vlrs ) except ( RuntimeError , errors . LazPerfNotFound ) as e : logger . error ( "LazPerf failed to decompress ({}), trying laszip." . format ( e ) ) self . stream . seek ( self . start_pos ) self . __init__ ( io . BytesIO ( laszip_decompress ( self . stream ) ) ) return self . read ( ) if points . point_format . has_waveform_packet : self . stream . seek ( self . start_pos + self . header . start_of_waveform_data_packet_record ) if self . header . global_encoding . are_waveform_flag_equal ( ) : raise errors . PylasError ( "Incoherent values for internal and external waveform flags, both are {})" . format ( "set" if self . header . global_encoding . waveform_internal else "unset" ) ) if self . header . global_encoding . waveform_internal : # TODO: Find out what to do with these _ , _ = self . _read_internal_waveform_packet ( ) elif self . header . global_encoding . waveform_external : logger . info ( "Waveform data is in an external file, you'll have to load it yourself" ) if self . header . version >= "1.4" : evlrs = self . read_evlrs ( ) return las14 . LasData ( header = self . header , vlrs = vlrs , points = points , evlrs = evlrs ) return las12 . LasData ( header = self . header , vlrs = vlrs , points = points )
Reads the whole las data (header, vlrs ,points, etc) and returns a LasData
        object
Reads the whole las data ( header vlrs points etc ) and returns a LasData object