Skip to main content
Added file size and run times
Source Link

Cost distance function from WhiteboxTools (v.0.11.0) gets stuck in an endless loop after execution. The inputs are 8-bit unsigned interger GeoTIFFs. The source raster has values 1 and Null (size: 16 KB), and cost raster has values from 10-54 (size: 460 KB) (see below for an image of source (grey), cost raster (gradient white-to-red) and white is null/nodata). If necessary, I can provide the GeoTIFFs if needed.

WhiteboxTools - Cost distance code:

import sys
wbtools_dir = r'C:\WhiteboxTools_win_amd64\WBT'
sys.path.insert(0, wbtools_dir)

from whitebox_tools import WhiteboxTools

wbt = WhiteboxTools()

source = "c:/src2.tif"
cost = "c:/cst1.tif"
out_accum = "c:/cd.tif"
out_backlink = "c:/backlink.tif"

wbt.cost_distance(source, cost, out_accum, out_backlink)

Output:

***************************
* Welcome to CostDistance *
***************************
Reading source data...
Reading cost data...
Initializing: 0%
Initializing: 1%
...
Initializing: 99%
Initializing: 100%
Loop 1: 0%
Loop 1: 1%
Loop 1: 2%
Loop 1: 3%
...
Loop 4000: 1%

It takes 2-3 seconds to complete each loop and the process was killed after 30-45 minutes. I replicated the cost distance in ArcMap and run time was ~45 seconds.

The code comes directly from the WhiteboxTools user manual and it executes without any issues, so I suspect it is either user error (need to format my source and cost rasters in certain way) or Whitebox bug. Any ideas? Also, I am able to execute other Whitebox tools such as breach_depressions() and create valid outputs.

source and cost surfaces

Cost distance function from WhiteboxTools (v.0.11.0) gets stuck in an endless loop after execution. The inputs are 8-bit unsigned interger GeoTIFFs. The source raster has values 1 and Null, and cost raster has values from 10-54 (see below for an image of source (grey), cost raster (gradient white-to-red) and white is null/nodata). If necessary, I can provide the GeoTIFFs if needed.

WhiteboxTools - Cost distance code:

import sys
wbtools_dir = r'C:\WhiteboxTools_win_amd64\WBT'
sys.path.insert(0, wbtools_dir)

from whitebox_tools import WhiteboxTools

wbt = WhiteboxTools()

source = "c:/src2.tif"
cost = "c:/cst1.tif"
out_accum = "c:/cd.tif"
out_backlink = "c:/backlink.tif"

wbt.cost_distance(source, cost, out_accum, out_backlink)

Output:

***************************
* Welcome to CostDistance *
***************************
Reading source data...
Reading cost data...
Initializing: 0%
Initializing: 1%
...
Initializing: 99%
Initializing: 100%
Loop 1: 0%
Loop 1: 1%
Loop 1: 2%
Loop 1: 3%
...

The code comes directly from the WhiteboxTools user manual and it executes without any issues, so I suspect it is either user error (need to format my source and cost rasters in certain way) or Whitebox bug. Any ideas? Also, I am able to execute other Whitebox tools such as breach_depressions() and create valid outputs.

source and cost surfaces

Cost distance function from WhiteboxTools (v.0.11.0) gets stuck in an endless loop after execution. The inputs are 8-bit unsigned interger GeoTIFFs. The source raster has values 1 and Null (size: 16 KB), and cost raster has values from 10-54 (size: 460 KB) (see below for an image of source (grey), cost raster (gradient white-to-red) and white is null/nodata). If necessary, I can provide the GeoTIFFs if needed.

WhiteboxTools - Cost distance code:

import sys
wbtools_dir = r'C:\WhiteboxTools_win_amd64\WBT'
sys.path.insert(0, wbtools_dir)

from whitebox_tools import WhiteboxTools

wbt = WhiteboxTools()

source = "c:/src2.tif"
cost = "c:/cst1.tif"
out_accum = "c:/cd.tif"
out_backlink = "c:/backlink.tif"

wbt.cost_distance(source, cost, out_accum, out_backlink)

Output:

***************************
* Welcome to CostDistance *
***************************
Reading source data...
Reading cost data...
Initializing: 0%
Initializing: 1%
...
Initializing: 99%
Initializing: 100%
Loop 1: 0%
Loop 1: 1%
Loop 1: 2%
Loop 1: 3%
...
Loop 4000: 1%

It takes 2-3 seconds to complete each loop and the process was killed after 30-45 minutes. I replicated the cost distance in ArcMap and run time was ~45 seconds.

The code comes directly from the WhiteboxTools user manual and it executes without any issues, so I suspect it is either user error (need to format my source and cost rasters in certain way) or Whitebox bug. Any ideas? Also, I am able to execute other Whitebox tools such as breach_depressions() and create valid outputs.

source and cost surfaces

Source Link

Whitebox's cost distance tool stuck in endlesss loop

Cost distance function from WhiteboxTools (v.0.11.0) gets stuck in an endless loop after execution. The inputs are 8-bit unsigned interger GeoTIFFs. The source raster has values 1 and Null, and cost raster has values from 10-54 (see below for an image of source (grey), cost raster (gradient white-to-red) and white is null/nodata). If necessary, I can provide the GeoTIFFs if needed.

WhiteboxTools - Cost distance code:

import sys
wbtools_dir = r'C:\WhiteboxTools_win_amd64\WBT'
sys.path.insert(0, wbtools_dir)

from whitebox_tools import WhiteboxTools

wbt = WhiteboxTools()

source = "c:/src2.tif"
cost = "c:/cst1.tif"
out_accum = "c:/cd.tif"
out_backlink = "c:/backlink.tif"

wbt.cost_distance(source, cost, out_accum, out_backlink)

Output:

***************************
* Welcome to CostDistance *
***************************
Reading source data...
Reading cost data...
Initializing: 0%
Initializing: 1%
...
Initializing: 99%
Initializing: 100%
Loop 1: 0%
Loop 1: 1%
Loop 1: 2%
Loop 1: 3%
...

The code comes directly from the WhiteboxTools user manual and it executes without any issues, so I suspect it is either user error (need to format my source and cost rasters in certain way) or Whitebox bug. Any ideas? Also, I am able to execute other Whitebox tools such as breach_depressions() and create valid outputs.

source and cost surfaces