Skip to content

wbt_isobasins() crashed for any size >= 1e5, works well under #20

@Antoine-CSQN

Description

@Antoine-CSQN

Hello,
First of all thank you for this whitebox and its interface in R. I think it's a good tool for reproductible research in GIS, and it certainly makes some fastidious work with rgdal and raster easier.

I found what I think is a bug and I have no competence to fix it as I don't understand Rust.
When I try the to use the iso_basins() it works well for any size < 1e5 and crashes for any size > 1e5 (see exemple and console output below)

#Pre-processing
raw.dem <- dem.path #Any dem (mine is 10m*10m for a 1000 km² area)
wbt_feature_preserving_smoothing(raw.dem, "./smoothed.tif", filter=9, verbose_mode = TRUE)
wbt_breach_depressions("./smoothed.tif", "./breached.tif")
#Create isobasins for given size in cells
wbt_isobasins(dem = "./breached.tif", output = "./isobas_1km.tif", size = 1e4, wd = NULL, verbose_mode = TRUE) #works (exec time = 0.726s)
wbt_isobasins(dem = "./breached.tif", output = "./isobas_9pt99km.tif", size = 9.99e4, wd = NULL, verbose_mode = TRUE) #works (exec time = 0.688s)
wbt_isobasins(dem = "./breached.tif", output = "./isobas_10km.tif", size = 1e5, wd = NULL, verbose_mode = TRUE)  # Crash (immediately)

[1] "thread 'main' panicked at 'called Result::unwrap() on an Err value: ParseIntError { kind: InvalidDigit }', src\tools\hydro_analysis\isobasins.rs:170:21"
[2] "note: run with RUST_BACKTRACE=1 environment variable to display a backtrace"
attr(,"status")
[1] 101
Warning message:
In system(args2, intern = TRUE) :
running command 'C:/Users/me/Documents/R/R-4.0.0/library/whitebox/WBT/whitebox_tools.exe --run=isobasins --dem=./breached.tif --output=./isobas_10km.tif --size=1e+05 -v' had status 101

This bug was reproducted with two different Windows computer (10 standard and 10 Pro), an up-to-date whitebox install and two different R Version (3.61 and 4.0.0).

If you can have a look I would be grateful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions