Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitebox tool function LidarDigitalSurfaceModel getting stuck at filtering stage #364

Open
aturgarg opened this issue Jul 18, 2023 · 1 comment

Comments

@aturgarg
Copy link

aturgarg commented Jul 18, 2023

  • whitebox version: v2.2.0
  • Python version: Python 3.9.13
  • Operating System: macOsX 13.2, Ubuntu 20.04, Ubuntu 22.04

Description

I am trying to convert lidar files to DSM raster, using method lidar_digital_surface_model (LidarDigitalSurfaceModel).
For certain lidars, the tool is getting stuck at filtering.
Example input lidar files can be obtained from USGS links:

  1. https://rockyweb.usgs.gov/vdelivery/Datasets/Staged/Elevation/LPC/Projects/FEMA_R6_AR_Dardanelle_Reservoir_QL2_Lidar/AR_DardanelleReservoir_2015/LAZ/USGS_LPC_FEMA_R6_AR_Dardanelle_Reservoir_QL2_Lidar_15svv560345.laz

  2. https://rockyweb.usgs.gov/vdelivery/Datasets/Staged/Elevation/LPC/Projects/FEMA_R6_AR_Dardanelle_Reservoir_QL2_Lidar/AR_DardanelleReservoir_2015/LAZ/USGS_LPC_FEMA_R6_AR_Dardanelle_Reservoir_QL2_Lidar_15svv560270.laz

Logs:


./whitebox_tools --run="LidarDigitalSurfaceModel" --wd="/tmp" --input='647910b9d34eac007b50fc55_USGS_LPC_FEMA_R6_AR_Dardanelle_Reservoir_QL2_Lidar_15svv560345.laz' --output='dsm_from_laz_1.tif' --resolution=0.5 --radius=0.5

***************************************
* Welcome to LidarDigitalSurfaceModel *
* Powered by WhiteboxTools            *
* www.whiteboxgeo.com                 *
***************************************
Performing interpolation...
Reading input LiDAR file...
Reading points: 0%
Reading points: 1%
Reading points: 2%
Reading points: 3%
.....
.....

Reading points: 99%
Reading points: 100%
Filtering points: 0%
Filtering points: 1%
Filtering points: 2%
Filtering points: 3%
....
....
Filtering points: 30%
Filtering points: 31%
Filtering points: 32%

Process got stuck at 32% for one on the Lidar file. This percentage varies from Lidar to Lidar.

Expected result:

  • Should convert Lidar to DSM raster
  • Or should fail gracefully

What I Did

Code used:


import whitebox

def convert_to_dsm(laz_file_name, output_file_name):
    wbt_digital_surface_model_lidar(laz_file_name, output_file_name)

def __handle_whitebox_errors__(output):
    if 'panicked' in output or 'Error reading LAZ' in output or 'Warning: No points found' in output:
       
        print(f"whitebox processing of lidar throw error: {output}")
        raise Exception(message = f"whitebox processing of lidar throw error: {output}")       
    else:
        print(f"{output}")

def wbt_digital_surface_model_lidar(lidar_file, converted_file_name) -> str:
    print("#initialize whitebox tool")
    wbt = whitebox.WhiteboxTools()
    print(f"Whitebox tool version: {wbt.version()}")
    wbt.work_dir = "/tmp"
    dsm_output_tif = converted_file_name 
    callback_function = lambda output: __handle_whitebox_errors__(output)
    
    wbt.lidar_digital_surface_model(
        i=lidar_file,
        output=dsm_output_tif,
        resolution=0.5,
        radius=0.5, 
        minz=None, 
        maxz=None, 
        max_triangle_edge_length=None,
        callback=callback_function
    )               
         
    print(f"dsm_output_tif: {dsm_output_tif}")
    return dsm_output_tif

if __name__ == "__main__":
    laz_file = "647910b9d34eac007b50fc55_USGS_LPC_FEMA_R6_AR_Dardanelle_Reservoir_QL2_Lidar_15svv560345.laz"
    tif_file_name = "dsm_from_laz_1.tif"
    convert_to_dsm(laz_file, tif_file_name)

    

@aturgarg
Copy link
Author

Also tried with:
Python version 3.10.10
whitebox version v2.3.0
Error is still same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant