spdv3¶
SPD V3 format driver and support functions
-
pylidar.lidarformats.spdv3.
HEADER_ARRAY_FIELDS
= ('BANDWIDTHS', 'WAVELENGTHS')¶ header fields that are actually arrays
-
pylidar.lidarformats.spdv3.
HEADER_FIELDS
= {'AZIMUTH_MAX': <type 'numpy.float64'>, 'AZIMUTH_MIN': <type 'numpy.float64'>, 'BANDWIDTHS': <type 'numpy.float32'>, 'BIN_SIZE': <type 'numpy.float32'>, 'BLOCK_SIZE_POINT': <type 'numpy.uint16'>, 'BLOCK_SIZE_PULSE': <type 'numpy.uint16'>, 'BLOCK_SIZE_RECEIVED': <type 'numpy.uint16'>, 'BLOCK_SIZE_TRANSMITTED': <type 'numpy.uint16'>, 'CAPTURE_DAY_OF': <type 'numpy.uint16'>, 'CAPTURE_HOUR_OF': <type 'numpy.uint16'>, 'CAPTURE_MINUTE_OF': <type 'numpy.uint16'>, 'CAPTURE_MONTH_OF': <type 'numpy.uint16'>, 'CAPTURE_SECOND_OF': <type 'numpy.uint16'>, 'CAPTURE_YEAR_OF': <type 'numpy.uint16'>, 'CREATION_DAY_OF': <type 'numpy.uint16'>, 'CREATION_HOUR_OF': <type 'numpy.uint16'>, 'CREATION_MINUTE_OF': <type 'numpy.uint16'>, 'CREATION_MONTH_OF': <type 'numpy.uint16'>, 'CREATION_SECOND_OF': <type 'numpy.uint16'>, 'CREATION_YEAR_OF': <type 'numpy.uint16'>, 'DEFINED_DECOMPOSED_PT': <type 'numpy.int16'>, 'DEFINED_DISCRETE_PT': <type 'numpy.int16'>, 'DEFINED_HEIGHT': <type 'numpy.int16'>, 'DEFINED_ORIGIN': <type 'numpy.int16'>, 'DEFINED_RECEIVE_WAVEFORM': <type 'numpy.int16'>, 'DEFINED_RGB': <type 'numpy.int16'>, 'DEFINED_TRANS_WAVEFORM': <type 'numpy.int16'>, 'FIELD_OF_VIEW': <type 'numpy.float32'>, 'FILE_SIGNATURE': <type 'str'>, 'FILE_TYPE': <type 'numpy.uint16'>, 'GENERATING_SOFTWARE': <type 'str'>, 'INDEX_TYPE': <type 'numpy.uint16'>, 'NUMBER_BINS_X': <type 'numpy.uint32'>, 'NUMBER_BINS_Y': <type 'numpy.uint32'>, 'NUMBER_OF_POINTS': <type 'numpy.uint64'>, 'NUMBER_OF_PULSES': <type 'numpy.uint64'>, 'NUM_OF_WAVELENGTHS': <type 'numpy.uint16'>, 'POINT_DENSITY': <type 'numpy.float32'>, 'PULSE_ALONG_TRACK_SPACING': <type 'numpy.float32'>, 'PULSE_ANGULAR_SPACING_AZIMUTH': <type 'numpy.float32'>, 'PULSE_ANGULAR_SPACING_ZENITH': <type 'numpy.float32'>, 'PULSE_CROSS_TRACK_SPACING': <type 'numpy.float32'>, 'PULSE_DENSITY': <type 'numpy.float32'>, 'PULSE_ENERGY': <type 'numpy.float32'>, 'PULSE_FOOTPRINT': <type 'numpy.float32'>, 'PULSE_INDEX_METHOD': <type 'numpy.uint16'>, 'RANGE_MAX': <type 'numpy.float64'>, 'RANGE_MIN': <type 'numpy.float64'>, 'RETURN_NUMBERS_SYN_GEN': <type 'numpy.int16'>, 'SCANLINE_IDX_MAX': <type 'numpy.float64'>, 'SCANLINE_IDX_MIN': <type 'numpy.float64'>, 'SCANLINE_MAX': <type 'numpy.float64'>, 'SCANLINE_MIN': <type 'numpy.float64'>, 'SENSOR_APERTURE_SIZE': <type 'numpy.float32'>, 'SENSOR_BEAM_DIVERGENCE': <type 'numpy.float32'>, 'SENSOR_HEIGHT': <type 'numpy.float64'>, 'SENSOR_MAX_SCAN_ANGLE': <type 'numpy.float32'>, 'SENSOR_PULSE_REPETITION_FREQ': <type 'numpy.float32'>, 'SENSOR_SCAN_RATE': <type 'numpy.float32'>, 'SENSOR_SPEED': <type 'numpy.float32'>, 'SENSOR_TEMPORAL_BIN_SPACING': <type 'numpy.float64'>, 'SPATIAL_REFERENCE': <type 'str'>, 'SYSTEM_IDENTIFIER': <type 'str'>, 'USER_META_DATA': <type 'str'>, 'VERSION_MAJOR_SPD': <type 'numpy.uint16'>, 'VERSION_MINOR_SPD': <type 'numpy.uint16'>, 'VERSION_POINT': <type 'numpy.uint16'>, 'VERSION_PULSE': <type 'numpy.uint16'>, 'WAVEFORM_BIT_RES': <type 'numpy.uint16'>, 'WAVELENGTHS': <type 'numpy.float32'>, 'X_MAX': <type 'numpy.float64'>, 'X_MIN': <type 'numpy.float64'>, 'Y_MAX': <type 'numpy.float64'>, 'Y_MIN': <type 'numpy.float64'>, 'ZENITH_MAX': <type 'numpy.float64'>, 'ZENITH_MIN': <type 'numpy.float64'>, 'Z_MAX': <type 'numpy.float64'>, 'Z_MIN': <type 'numpy.float64'>}¶ Header fields and their types
-
pylidar.lidarformats.spdv3.
HEADER_TRANSLATION_DICT
= {1: 'NUMBER_OF_POINTS'}¶ Translation of header field names
-
pylidar.lidarformats.spdv3.
POINTS_HEADER_UPDATE_DICT
= {'RANGE': ('RANGE_MIN', 'RANGE_MAX'), 'X': ('X_MIN', 'X_MAX'), 'Y': ('Y_MIN', 'Y_MAX'), 'Z': ('Z_MIN', 'Z_MAX')}¶ for updating the header
-
pylidar.lidarformats.spdv3.
POINT_DTYPE
= dtype([('RETURN_ID', 'u1'), ('GPS_TIME', '<f8'), ('X', '<f8'), ('Y', '<f8'), ('Z', '<f4'), ('HEIGHT', '<f4'), ('RANGE', '<f4'), ('AMPLITUDE_RETURN', '<f4'), ('WIDTH_RETURN', '<f4'), ('RED', '<u2'), ('GREEN', '<u2'), ('BLUE', '<u2'), ('CLASSIFICATION', 'u1'), ('USER_FIELD', '<u4'), ('IGNORE', 'u1'), ('WAVE_PACKET_DESC_IDX', '<i2'), ('WAVEFORM_OFFSET', '<u4')])¶ so we can check the user has passed in expected array type
-
pylidar.lidarformats.spdv3.
PULSES_HEADER_UPDATE_DICT
= {'AZIMUTH': ('AZIMUTH_MIN', 'AZIMUTH_MAX'), 'SCANLINE': ('SCANLINE_MIN', 'SCANLINE_MAX'), 'SCANLINE_IDX': ('SCANLINE_IDX_MIN', 'SCANLINE_IDX_MAX'), 'ZENITH': ('ZENITH_MIN', 'ZENITH_MAX')}¶ for updating the header
-
pylidar.lidarformats.spdv3.
PULSE_DTYPE
= dtype([('GPS_TIME', '<u8'), ('PULSE_ID', '<u8'), ('X_ORIGIN', '<f8'), ('Y_ORIGIN', '<f8'), ('Z_ORIGIN', '<f4'), ('H_ORIGIN', '<f4'), ('X_IDX', '<f8'), ('Y_IDX', '<f8'), ('AZIMUTH', '<f4'), ('ZENITH', '<f4'), ('NUMBER_OF_RETURNS', 'u1'), ('NUMBER_OF_WAVEFORM_TRANSMITTED_BINS', '<u2'), ('NUMBER_OF_WAVEFORM_RECEIVED_BINS', '<u2'), ('RANGE_TO_WAVEFORM_START', '<f4'), ('AMPLITUDE_PULSE', '<f4'), ('WIDTH_PULSE', '<f4'), ('USER_FIELD', '<u4'), ('SOURCE_ID', '<u2'), ('SCANLINE', '<u4'), ('SCANLINE_IDX', '<u2'), ('RECEIVE_WAVE_NOISE_THRES', '<f4'), ('TRANS_WAVE_NOISE_THRES', '<f4'), ('WAVELENGTH', '<f4'), ('RECEIVE_WAVE_GAIN', '<f4'), ('RECEIVE_WAVE_OFFSET', '<f4'), ('TRANS_WAVE_GAIN', '<f4'), ('TRANS_WAVE_OFFSET', '<f4'), ('PTS_START_IDX', '<u8'), ('TRANSMITTED_START_IDX', '<u8'), ('RECEIVED_START_IDX', '<u8')])¶ so we can check the user has passed in expected array type
-
class
pylidar.lidarformats.spdv3.
SPDV3File
(fname, mode, controls, userClass)[source]¶ Class to support reading and writing of SPD Version 3.x files.
Uses h5py to handle access to the underlying HDF5 file.
-
static
convertHeaderToDictionary
(header)[source]¶ Static method to convert the header returned by h5py into a normal dictionary
-
getNativeDataType
(colName, arrayType)[source]¶ Return the native dtype (numpy.int16 etc)that a column is stored as internally. Provided so scaling can be adjusted when translating between formats.
arrayType is one of the lidarprocessor.ARRAY_TYPE_* constants
-
preparePointsForWriting
(points, pulses)[source]¶ Called from writeData(). Massages what the user has passed into something we can write back to the file.
-
preparePulsesForWriting
(pulses)[source]¶ Called from writeData(). Massages what the user has passed into something we can write back to the file.
-
prepareReceivedForWriting
(received, waveformInfo)[source]¶ Called from writeData(). Massages what the user has passed into something we can write back to the file.
-
prepareTransmittedForWriting
(transmitted, waveformInfo)[source]¶ Called from writeData(). Massages what the user has passed into something we can write back to the file.
-
readPointsByPulse
(colNames=None)[source]¶ Return a 2d masked structured array of point that matches the pulses.
-
readPointsForExtent
(colNames=None)[source]¶ Read out the points for the given extent as a 1d structured array.
-
readPointsForExtentByBins
(extent=None, colNames=None, indexByPulse=False, returnPulseIndex=False)[source]¶ Return the points as a 3d structured masked array.
Note that because the spatial index on a SPDV3 file is on pulses this may miss points that are attached to pulses outside the current extent. If this is a problem then select an overlap large enough.
- Pass indexByPulse=True to bin the points by the locations of the pulses
- (using X_IDX and Y_IDX rather than the locations 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())
-
readPulsesForExtent
(colNames=None)[source]¶ Return the pulses for the given extent as a 1d structured array
-
readPulsesForExtentByBins
(extent=None, colNames=None)[source]¶ Return the pulses as a 3d structured masked array.
-
readReceived
()[source]¶ Return the 3d masked integer array of received for each of the current pulses. SPDV3 only has 1 transmitted per pulse so the second axis is empty. First axis is waveform bin and last is pulse.
-
static
-
class
pylidar.lidarformats.spdv3.
SPDV3FileInfo
(fname)[source]¶ Class that gets information about a SPDV3 file and makes it available as fields.
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_ALLCLASSES
= 100¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_ALLCLASSES_TOP
= 101¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_BRANCH
= 11¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_BUILDING
= 7¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_CREATED
= 2¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_FOLIAGE
= 10¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_GROUND
= 3¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_HIGHVEGE
= 6¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_KEYGRDPTS
= 105¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_LOWVEGE
= 4¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_MEDVEGE
= 5¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_NOTGROUND
= 104¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_TRUNK
= 9¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_UNCLASSIFIED
= 1¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_UNDEFINED
= 0¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_VEGE
= 103¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_VEGETOP
= 102¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_WALL
= 12¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_CLASSIFICATION_WATER
= 8¶ classification codes
-
pylidar.lidarformats.spdv3.
SPDV3_INDEX_CARTESIAN
= 1¶ types of indexing in the file
-
pylidar.lidarformats.spdv3.
SPDV3_INDEX_CYLINDRICAL
= 3¶ types of indexing in the file
-
pylidar.lidarformats.spdv3.
SPDV3_INDEX_POLAR
= 4¶ types of indexing in the file
-
pylidar.lidarformats.spdv3.
SPDV3_INDEX_SCAN
= 5¶ types of indexing in the file
-
pylidar.lidarformats.spdv3.
SPDV3_INDEX_SPHERICAL
= 2¶ types of indexing in the file
-
pylidar.lidarformats.spdv3.
SPDV3_SI_COUNT_DTYPE
¶ alias of
numpy.uint32
-
pylidar.lidarformats.spdv3.
SPDV3_SI_INDEX_DTYPE
¶ alias of
numpy.uint64