r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
601 stars 131 forks source link

Error: 1 points were not normalizable. Process aborted. #529

Closed mkieser closed 2 years ago

mkieser commented 2 years ago

I've encountered this error. Any ideas on how else I could check the LAS file for issues causing the problem? Thank you.

I see there was previously a similar issue with the normalize_height(las, tin()) algorithm: https://github.com/r-lidar/lidR/issues/356

lidar_data <- readLAS(lidar_path, select = "xyzicnr")
lidar_data <- las_rescale(lidar_data, 0.01, 0.01, 0.01)
#> Warning messages:
#> 1: Invalid header: X scale factors should be factor ten of 0.1 or 0.5 or 0.25 not 4.03814907218706e-07
#> 2: Invalid header: Y scale factors should be factor ten of 0.1 or 0.5 or 0.25 not 6.9849193128687e-07
#> 3: Invalid header: Z scale factors should be factor ten of 0.1 or 0.5 or 0.25 not 1.22849922684417e-06
#> 4: Invalid data: 133 points with a return number equal to 0 found.
#> 5: Invalid data: 1064 points with a number of returns equal to 0 found.
#> 6: Invalid data: 931 points with a 'return number' greater than the 'number of returns'.
lidar_data <- las_rescale(lidar_data, 0.01, 0.01, 0.01)
#> X coordinates were moved by 0.0025 on average
#> Y coordinates were moved by 0.0025 on average
#> Z coordinates were moved by 0.004 on average
lidar_data <- filter_duplicates(lidar_data)
lidar_data <- filter_poi(lidar_data, ReturnNumber != 0L)
lidar_data <- filter_poi(lidar_data, NumberOfReturns > 0L)
lidar_data <- filter_poi(lidar_data, ReturnNumber <= NumberOfReturns)
las_check(lidar_data, print = TRUE)

#>  Checking the data
#>   - Checking coordinates... ✓
#>   - Checking coordinates type... ✓
#>   - Checking coordinates range... ✓
#>   - Checking coordinates quantization... ✓
#>   - Checking attributes type... ✓
#>   - Checking ReturnNumber validity... ✓
#>   - Checking NumberOfReturns validity... ✓
#>   - Checking ReturnNumber vs. NumberOfReturns... ✓
#>   - Checking RGB validity... ✓
#>   - Checking absence of NAs... ✓
#>   - Checking duplicated points... ✓
#>   - Checking degenerated ground points...
#>     ⚠ There were 10399 degenerated ground points. Some X Y coordinates were repeated but with different Z coordinates
#>   - Checking attribute population... ✓
#>   - Checking gpstime incoherances skipped
#>   - Checking flag attributes... ✓
#>   - Checking user data attribute... skipped
#>  Checking the header
#>   - Checking header completeness... ✓
#>   - Checking scale factor validity... ✓
#>   - Checking point data format ID validity... ✓
#>   - Checking extra bytes attributes validity... ✓
#>   - Checking the bounding box validity... ✓
#>   - Checking coordinate reference system... ✓
#>  Checking header vs data adequacy
#>   - Checking attributes vs. point format... ✓
#>   - Checking header bbox vs. actual content... ✓
#>   - Checking header number of points vs. actual content... ✓
#>   - Checking header return number vs. actual content... ✓
#>  Checking coordinate reference system...
#>   - Checking if the CRS was understood by R... ✓
#>  Checking preprocessing already done
#>   - Checking ground classification... yes
#>   - Checking normalization... no
#>   - Checking negative outliers... ✓
#>   - Checking flightline classification... skipped>
lasnorm <- normalize_height(lidar_data, knnidw(), na.rm = FALSE, Wdegenerated = TRUE)
#> Error: 1 points were not normalizable. Process aborted.========================] 100% (2 threads)
#> In addition: Warning message:
#> There were 10399 degenerated ground points. Some X Y coordinates were repeated but with different Z coordinates. min Z were retained.
Jean-Romain commented 2 years ago

This question has already been asked multiple times. You may find and explanation here or here. If not, then you have another problem but you must share your point cloud if you want me to reproduce.

In your case knnidw has a parameter rmax = 50. You can try to increase it. You can also use na.rm = TRUE. In the next release (v4.0.0) this error has been removed and normalize_height uses the nearest neighbor to force interpolation of "non interpolable" points. It does not solve the problem but avoid annoying failures.

mkieser commented 2 years ago

Thank you, na.rm = TRUE did not work, but rmax = 100 did. Thank you.