Base¶
Base Module Basics:
Most of the functionality of laspy is exposed on the file and header modules, however it will sometimes be convenient to dig into the base as well. The two workhorses of the base class are Writer and Reader, and they are both subclasses of FileManager, which handles a lot of the file initialization logic, as well as file reading capability.
- class laspy.base.FileManager(filename, mode, header=False, vlrs=False, evlrs=False)[source]¶
Superclass of Reader and Writer, provides most of the data manipulation functionality in laspy.
- class laspy.base.Reader(filename, mode, header=False, vlrs=False, evlrs=False)[source]¶
Just a subclass of FileManager
- close()¶
Help the garbage collector by deleting some of the circular references
- get_dimension(name)¶
Grab a point dimension by name, returning a numpy array. Refers to reader.point_format for the required Spec instance.
- get_header(file_version=1.2)¶
Return the header object, or create one if absent.
- get_header_property(name)¶
Wrapper for grabbing unpacked header data with _get_datum
- get_padding()¶
Return the padding between the end of the VLRs and the beginning of the point records
- get_point(index, nice=False)¶
Return point object for point of number index / #legacy_api
- get_pointrecordscount()¶
calculate the number of point records
- get_points()¶
Return a numpy array of all point data in a file.
- get_raw_point(index)¶
Return the raw bytestring associated with point of number index
- get_vlrs()¶
Populate and return list of
laspy.header.VLR
objects`.
- populate_vlrs()¶
Catalogue the variable length records
- class laspy.base.Writer(filename, mode, header=False, vlrs=False, evlrs=False)[source]¶
- _set_datum(rec_offs, dim, val)[source]¶
Set a non dimension field as with _set_raw_datum, but supply a formatted value
- close(ignore_header_changes=False, minmax_mode='scaled')[source]¶
Flush changes to mmap and close mmap and fileref
- pad_file_for_point_recs(num_recs)[source]¶
Pad the file with null bytes out to a calculated length based on the data given. This is usually a side effect of set_dimension being called for the first time on a file in write mode.
- class laspy.base.DataProvider(filename, manager)[source]¶
Provides access to the file object, the memory map, and the numpy point map.
- get_point_map(informat)[source]¶
Get point map is used to build and return a numpy frombuffer view of the mmapped data, using a valid laspy.util.Format instance for the desired point format. This method is used to provide access to extra_bytes even when dimensions have been explicitly defined via an extra_bytes VLR record.