Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,16 @@ impl WhiteboxTool for DownslopeFlowpathLength {
// find its downslope neighbour
dir = pntr.get_value(y, x);
if dir > 0f64 && dir != nodata {
if dir > 128f64 || pntr_matches[dir as usize] == 999 {
return Err(Error::new(ErrorKind::InvalidInput,
"An unexpected value has been identified in the pointer image. This tool requires a pointer grid that has been created using either the D8 or Rho8 tools."));
}
// move x and y accordingly
c = pntr_matches[dir as usize];
x += dx[c];
y += dy[c];

if dir > 128f64 || c == 999 || pntr.get_value(y, x) == nodata {
return Err(Error::new(ErrorKind::InvalidInput,
"An unexpected value has been identified in the pointer image. This tool requires a pointer grid that has been created using either the D8 or Rho8 tools."));
}

dist += grid_lengths[c] * weights.get_value(y, x) as f64;

if output.get_value(y, x) != -999f64 {
Expand Down