= Calculating Elevation differences for LiDAR data = To calculate the difference between overlapping LiDAR lines a raster is generated from each. For each overlapping pairs the difference in elevation pixels in areas of with low variance (i.e., flat) is calculated. To run for a delivery the following script is used: {{{ mkdir -p /tmp/2015_249_lidar_diffs calculate_lidar_elevation_diffs.py -c lidar_genreadme-airborne.cfg \ -p UTM27N -i delivery/EUFAR15_48-249-lidar-20160223/flightlines/las1.2/ -o /tmp/2015_249_lidar_diffs }}} This will produce an output similar to: ``` 001a 002a 35; 002a 003a 18; 003a 004a 9; 004a 005a 7; 005a 006a 20; 006a 007a 4; 007a 008a 11; 008a 009a 10; 009a 010a 6; 010a 011a 5; 011a 012a 6; 012a 013a 8; 013a 014 Insufficient overlapping pixels; 014 HNI4_cross Insufficient overlapping pixels; HNI4_cross 001b No-overlap; 001b 002b 20; 002b 003b 14; 003b 004b 15; 004b 005b 14; 005b 006b 16; 006b 007b 12; 007b 008b 15; 008b 009b 11; 009b 010b 7; 010b 011b 8; 011b 012b 5; 012b 013b 8; 013b HNI3_cross Insufficient overlapping pixels; ``` Which can be pasted into the readme config file. The script assumes sequential lines overlap which isn't always the case. To run the script for individual lines use: {{{ create_lidar_diff_image.py -d /tmp/2015_249_lidar_diffs/ \ -o /tmp/2015_249_lidar_diffs/001a_002a_diff.tif \ --projection UTM27N \ delivery/EUFAR15_48-249-lidar-20160223/flightlines/las1.2/LDR-EUFAR15_48-2015-249-01.LAS \ delivery/EUFAR15_48-249-lidar-20160223/flightlines/las1.2/LDR-EUFAR15_48-2015-249-02.LAS }}} This will produce the following output: {{{ ******************* Min: 0.000 Max: 1.302 Mean: 0.355 StdDev: 0.071 Median: 0.351 ******************* }}} Copy the median difference into the config file. For areas where there is dense vegetation there might be too few pixels above the variance threshold to calculate a difference. If this is the case a warning will be printed (`Too few valid pixels overlap to be able to output a reliable difference between lines 010a and 011a`). The default variance is 0.1 m, try increasing to 0.2 m using `--max_variance 0.2` and running again to see if this provides sufficient pixels. You can check which areas are being used for the difference and which are masked out (set to NaN) by opening the difference images (e.g., 001a_002a_diff.tif in TuiView or ENVI). If you change the variance make sure it is noted in the ticket. Once the difference table has been populated for all lines the temp directory should be removed.