Skip to content

Commit 6aba2cb

Browse files
committed
updates
1 parent e7ea1ee commit 6aba2cb

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/tools/hydro_analysis/fill_depressions.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,15 @@ impl WhiteboxTool for FillDepressions {
236236
// small_num = 1.0 / elev_multiplier as f64;
237237
// }
238238

239-
let small_num = if !flat_increment.is_nan() {
239+
let small_num = if fix_flats && !flat_increment.is_nan() {
240240
flat_increment
241-
} else {
241+
} else if fix_flats {
242242
let min_val = input.configs.minimum;
243243
let elev_digits = ((input.configs.maximum - min_val) as i64).to_string().len();
244244
let elev_multiplier = 10.0_f64.powi((6 - elev_digits) as i32);
245245
1.0_f64 / elev_multiplier as f64
246+
} else {
247+
0f64
246248
};
247249

248250
let mut output = Raster::initialize_using_file(&output_file, &input);

whitebox_tools.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ def list_tools(self, keywords=[]):
375375

376376

377377

378+
378379

379380

380381
##############
@@ -3463,20 +3464,22 @@ def fill_burn(self, dem, streams, output, callback=None):
34633464
args.append("--output='{}'".format(output))
34643465
return self.run_tool('fill_burn', args, callback) # returns 1 if error
34653466

3466-
def fill_depressions(self, dem, output, fix_flats=True, callback=None):
3467+
def fill_depressions(self, dem, output, fix_flats=True, flat_increment=None, callback=None):
34673468
"""Fills all of the depressions in a DEM. Depression breaching should be preferred in most cases.
34683469
34693470
Keyword arguments:
34703471
34713472
dem -- Input raster DEM file.
34723473
output -- Output raster file.
34733474
fix_flats -- Optional flag indicating whether flat areas should have a small gradient applied.
3475+
flat_increment -- Optional elevation increment applied to flat areas.
34743476
callback -- Custom function for handling tool text outputs.
34753477
"""
34763478
args = []
34773479
args.append("--dem='{}'".format(dem))
34783480
args.append("--output='{}'".format(output))
34793481
if fix_flats: args.append("--fix_flats")
3482+
if flat_increment is not None: args.append("--flat_increment='{}'".format(flat_increment))
34803483
return self.run_tool('fill_depressions', args, callback) # returns 1 if error
34813484

34823485
def fill_single_cell_pits(self, dem, output, callback=None):

0 commit comments

Comments
 (0)