generic¶
Base class for LiDAR format reader/writers
-
pylidar.lidarformats.generic.
ARRAY_TYPE_POINTS
= 0¶ For use in userclass.LidarData.translateFieldNames() and LiDARFile.getTranslationDict()
-
pylidar.lidarformats.generic.
ARRAY_TYPE_PULSES
= 1¶ For use in userclass.LidarData.translateFieldNames() and LiDARFile.getTranslationDict()
-
pylidar.lidarformats.generic.
ARRAY_TYPE_WAVEFORMS
= 2¶ For use in userclass.LidarData.translateFieldNames() and LiDARFile.getTranslationDict()
-
pylidar.lidarformats.generic.
CLASSIFICATION_BRANCH
= 102¶ Extended classifications
-
pylidar.lidarformats.generic.
CLASSIFICATION_BRIDGE
= 12¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_BUILDING
= 6¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_COLNAME
= 'CLASSIFICATION'¶ Name of column to treat as classification
-
pylidar.lidarformats.generic.
CLASSIFICATION_CREATED
= 0¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_FOLIAGE
= 101¶ Extended classifications
-
pylidar.lidarformats.generic.
CLASSIFICATION_GROUND
= 2¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_HIGHPOINT
= 8¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_HIGHVEGE
= 5¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_INSULATOR
= 16¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_LOWPOINT
= 7¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_LOWVEGE
= 3¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_MEDVEGE
= 4¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_RAIL
= 10¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_ROAD
= 11¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_TRANSTOWER
= 15¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_TRUNK
= 100¶ Extended classifications
-
pylidar.lidarformats.generic.
CLASSIFICATION_UNCLASSIFIED
= 1¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_WATER
= 9¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_WIRECOND
= 14¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CLASSIFICATION_WIREGUARD
= 13¶ Classifications from the LAS spec. See LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
CREATE
= 2¶ access modes passed to driver constructor
-
pylidar.lidarformats.generic.
FIELD_POINTS_RETURN_NUMBER
= 1¶ ‘standard’ fields that have different names for different formats
-
pylidar.lidarformats.generic.
FIELD_PULSES_TIMESTAMP
= 2¶ ‘standard’ fields that have different names for different formats
-
pylidar.lidarformats.generic.
HEADER_NUMBER_OF_POINTS
= 1¶ ‘standard’ header fields that have different names for different formats
-
exception
pylidar.lidarformats.generic.
LiDARArrayColumnError
[source]¶ Unsupported operation on a structured array
-
class
pylidar.lidarformats.generic.
LiDARFile
(fname, mode, controls, userClass)[source]¶ Base class for all LiDAR Format reader/writers.
It is intended that very little work happens until the user actually asks for the data - then read it in. Subsequent calls for the same extent should return cached data.
-
static
getHeaderTranslationDict
()[source]¶ Return a dictionary keyed on HEADER_* values (above) that can be used to translate dictionary field names between the formats
-
getNativeDataType
(colName, arrayType)[source]¶ Return the native dtype (numpy.int16 etc) that a column is stored as internally after scaling (if any) is applied. Provided so scaling can be adjusted when translating between formats.
arrayType is one of the lidarprocessor.ARRAY_TYPE_* constants
Raises generic.LiDARArrayColumnError if information cannot be found for the column.
-
getNullValue
(colName, arrayType, scaled=True)[source]¶ Get the ‘null’ value for the given column.
arrayType is one of the lidarprocessor.ARRAY_TYPE_* constants
By default the returned value is scaled, change this with the ‘scaled’ parameter.
Raises generic.LiDARArrayColumnError if information cannot be found for the column.
-
getScaling
(colName, arrayType)[source]¶ Returns the scaling (gain, offset) for the given column name
arrayType is one of the ARRAY_TYPE_* constants.
Raises generic.LiDARArrayColumnError if no scaling (yet) set for this column.
-
getScalingColumns
(arrayType)[source]¶ Return a list of columns names that will need scaling to be set when creating a new file.
arrayType is one of the lidarprocessor.ARRAY_TYPE_* constants
-
getTotalNumberPulses
()[source]¶ Returns the total number of pulses in this file. Used for progress.
Raise a LiDARFunctionUnsupported error if driver does not support easily finding the total number of pulses.
-
static
getTranslationDict
(arrayType)[source]¶ Return a dictionary keyed on FIELD_* values (above) that can be used to translate field names between the formats arrayType is the type of array that is to be translated (ARRAY_TYPE_*)
For use by the
pylidar.userclases.LidarData.translateFieldNames()
function.
-
readPointsByPulse
()[source]¶ Read a 2d structured masked array containing the points for each pulse.
-
readPointsForExtent
(colNames=None)[source]¶ Read all the points within the given extent as 1d structured array. The names of the fields in this array will be defined by the driver.
colNames can be a name or list of column names to return. By default all columns are returned.
-
readPointsForExtentByBins
(colNames=None, indexByPulse=False, returnPulseIndex=False)[source]¶ Read all the points within the given extent as a 3d structured masked array to match the block/bins being used.
The extent/binning for the read data can be overriden by passing in a Extent instance.
colNames can be a name or list of column names to return. By default all columns are returned.
- Pass indexByPulse=True to bin the points by the locations of the pulses
- instead of the points.
- Pass returnPulseIndex=True to also return a masked 3d array of
- the indices into the 1d pulse array (as returned by readPulsesForExtent())
-
readPointsForRange
(colNames=None)[source]¶ Reads the points for the current range. Returns a 1d array.
Returns an empty array if range is outside of the current file.
colNames can be a list of column names to return. By default all columns are returned.
-
readPulsesForExtent
(colNames=None)[source]¶ Read all the pulses within the given extent as 1d structured array. The names of the fields in this array will be defined by the driver.
colNames can be a name or list of column names to return. By default all columns are returned.
-
readPulsesForExtentByBins
(colNames=None)[source]¶ Read all the pulses within the given extent as a 3d structured masked array to match the block/bins being used.
The extent/binning for the read data can be overriden by passing in a Extent instance.
colNames can be a name or list of column names to return. By default all columns are returned.
-
readPulsesForRange
(colNames=None)[source]¶ Reads the pulses for the current range. Returns a 1d array.
Returns an empty array if range is outside of the current file.
colNames can be a list of column names to return. By default all columns are returned.
-
recodeClassification
(array, direction, colNames=None)[source]¶ Recode classification column (if it exists in array) in the specified direction.
If array is not structured and colNames is a string equal to CLASSIFICATION_COLNAME, then the array is treated as the classification column.
-
setNativeDataType
(colName, arrayType, dtype)[source]¶ Set the native dtype (numpy.int16 etc) that a column is stored as internally after scaling (if any) is applied.
arrayType is one of the lidarprocessor.ARRAY_TYPE_* constants
generic.LiDARArrayColumnError is raised if this cannot be set for the column.
The default behaviour is to create new columns in the correct type for the format, or if they are optional, in the same type as the input array.
-
setNullValue
(colName, arrayType, value, scaled=True)[source]¶ Set the ‘null’ value for the given column.
arrayType is one of the lidarprocessor.ARRAY_TYPE_* constants
By default the value is treated as the scaled value, but this can be changed with the ‘scaled’ parameter.
generic.LiDARArrayColumnError is raised if this cannot be set for the column.
-
setPulseRange
(pulseRange)[source]¶ Sets the PulseRange object to use for non spatial reads/writes.
Return False if outside the range of data.
-
setScaling
(colName, arrayType, gain, offset)[source]¶ Set the scaling for the given column name
arrayType is one of the ARRAY_TYPE_* constants
-
static
subsetColumns
(array, colNames)[source]¶ Internal method. Subsets the given column names from the array and returns it. colNames can be either a string or a sequence of column names. If None the input array is returned.
-
writeData
(pulses=None, points=None, transmitted=None, received=None, waveformInfo=None)[source]¶ Write data to file. pulses to be 1d structured array. points to be 2d points-by-pulses format. waveformInfo, transmitted and received to be 2d by-pulses format.
Pass None if no data to be written or data unchanged (for update).
-
static
-
exception
pylidar.lidarformats.generic.
LiDARFileException
[source]¶ Base class for LiDAR format reader/writers
-
class
pylidar.lidarformats.generic.
LiDARFileInfo
(fname)[source]¶ Info for a Lidar file
-
static
getDriverName
()[source]¶ Return name of driver - just a short unique name is fine. should match the
pylidar.lidarformats.generic.LiDARFile.getDriverName()
call for the same format.
-
static
-
exception
pylidar.lidarformats.generic.
LiDARFormatDriverNotFound
[source]¶ None of the drivers can open the file
-
exception
pylidar.lidarformats.generic.
LiDARFormatNotUnderstood
[source]¶ Raised when driver cannot open file
-
exception
pylidar.lidarformats.generic.
LiDARFunctionUnsupported
[source]¶ Function unsupported by LiDAR driver
-
exception
pylidar.lidarformats.generic.
LiDARInvalidData
[source]¶ Something is wrong with the data read or given
-
exception
pylidar.lidarformats.generic.
LiDARNonSpatialProcessing
[source]¶ Functionality not available when not processing spatially
-
exception
pylidar.lidarformats.generic.
LiDARPulseIndexUnsupported
[source]¶ The specified pulse index method is currently unsupported
-
exception
pylidar.lidarformats.generic.
LiDARScalingError
[source]¶ scaled data is outside the bounds of the data type
-
exception
pylidar.lidarformats.generic.
LiDARSpatialIndexNotAvailable
[source]¶ The specified spatial index not available for this file
-
exception
pylidar.lidarformats.generic.
LiDARWritingNotSupported
[source]¶ driver does not support writing
-
pylidar.lidarformats.generic.
MESSAGE_DEBUG
= 2¶ to be passed to message handler function controls.messageHandler
-
pylidar.lidarformats.generic.
MESSAGE_INFORMATION
= 1¶ to be passed to message handler function controls.messageHandler
-
pylidar.lidarformats.generic.
MESSAGE_WARNING
= 0¶ to be passed to message handler function controls.messageHandler
-
class
pylidar.lidarformats.generic.
PulseRange
(startPulse, endPulse)[source]¶ Class for setting the range of pulses to read/write for non spatial mode. Note: range does not include endPulse
-
pylidar.lidarformats.generic.
READ
= 0¶ access modes passed to driver constructor
-
pylidar.lidarformats.generic.
RECODE_TO_DRIVER
= 0¶ Codes to pass to LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
RECODE_TO_LAS
= 1¶ Codes to pass to LiDARFile.recodeClassification
-
pylidar.lidarformats.generic.
UPDATE
= 1¶ access modes passed to driver constructor
-
pylidar.lidarformats.generic.
getLidarFileInfo
(fname, verbose=False)[source]¶ Returns an instance of a LiDAR format info class. Or raises an exception if none found for the file.
-
pylidar.lidarformats.generic.
getReaderForLiDARFile
(fname, mode, controls, userClass, verbose=False)[source]¶ Returns an instance of a LiDAR format reader/writer or raises an exception if none found for the file.