Skip to content

Commit

Permalink
Further updates
Browse files Browse the repository at this point in the history
Further updates
  • Loading branch information
jblindsay committed Jan 28, 2019
1 parent 03ebe93 commit 3558912
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 34 deletions.
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ serde_json = "1.0.9"
statrs = "0.9.0"
zip = "0.3.0"

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = false
debug-assertions = false
codegen-units = 16
panic = 'unwind'
incremental = true
overflow-checks = false
# [profile.release]
# opt-level = 3
# debug = false
# rpath = false
# lto = false
# debug-assertions = false
# codegen-units = 16
# panic = 'unwind'
# incremental = true
# overflow-checks = false
6 changes: 6 additions & 0 deletions UserManual.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The WhiteboxTools User Manual is now available online at:

https://jblindsay.github.io/wbt_book/index.html

Please see the manual for details on usage and for descriptions of available tools.
The PDF version of the User Manual is no longer distributed along with the software.
Binary file removed WhiteboxToolsManual.pdf
Binary file not shown.
3 changes: 2 additions & 1 deletion src/tools/terrain_analysis/edge_density.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ use std::thread;
///
/// The distribution of `EdgeDensity` is highly dependent upon the value of the `norm_diff` used in the calculation. This
/// threshold may require experimentation to find an appropriate value and is likely dependent upon the topography and
/// source data.
/// source data. Nonetheless, experience has shown that `EdgeDensity` provides one of the best measures of surface
/// texture of any of the available roughness tools.
///
/// # See Also
/// `CircularVarianceOfAspect`, `MultiscaleRoughness`, `SurfaceAreaRatio`, `RuggednessIndex`
Expand Down
75 changes: 52 additions & 23 deletions whitebox_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def list_tools(self, keywords=[]):




##############
# Data Tools #
##############
Expand Down Expand Up @@ -2015,6 +2016,22 @@ def aspect(self, dem, output, zfactor=1.0, callback=None):
args.append("--zfactor={}".format(zfactor))
return self.run_tool('aspect', args, callback) # returns 1 if error

def circular_variance_of_aspect(self, dem, output, filter=11, callback=None):
"""Calculates the circular variance of aspect at a scale for a DEM.
Keyword arguments:
dem -- Input raster DEM file.
output -- Output raster roughness scale file.
filter -- Size of the filter kernel.
callback -- Custom function for handling tool text outputs.
"""
args = []
args.append("--dem='{}'".format(dem))
args.append("--output='{}'".format(output))
args.append("--filter={}".format(filter))
return self.run_tool('circular_variance_of_aspect', args, callback) # returns 1 if error

def dev_from_mean_elev(self, dem, output, filterx=11, filtery=11, callback=None):
"""Calculates deviation from mean elevation.
Expand Down Expand Up @@ -2115,6 +2132,26 @@ def drainage_preserving_smoothing(self, dem, output, filter=11, norm_diff=15.0,
args.append("--zfactor={}".format(zfactor))
return self.run_tool('drainage_preserving_smoothing', args, callback) # returns 1 if error

def edge_density(self, dem, output, filter=11, norm_diff=5.0, zfactor=1.0, callback=None):
"""Calculates the density of edges, or breaks-in-slope within DEMs.
Keyword arguments:
dem -- Input raster DEM file.
output -- Output raster file.
filter -- Size of the filter kernel.
norm_diff -- Maximum difference in normal vectors, in degrees.
zfactor -- Optional multiplier for when the vertical and horizontal units are not the same.
callback -- Custom function for handling tool text outputs.
"""
args = []
args.append("--dem='{}'".format(dem))
args.append("--output='{}'".format(output))
args.append("--filter={}".format(filter))
args.append("--norm_diff={}".format(norm_diff))
args.append("--zfactor={}".format(zfactor))
return self.run_tool('edge_density', args, callback) # returns 1 if error

def elev_above_pit(self, dem, output, callback=None):
"""Calculate the elevation of each grid cell above the nearest downstream pit cell or grid edge cell.
Expand Down Expand Up @@ -2255,28 +2292,6 @@ def find_ridges(self, dem, output, line_thin=True, callback=None):
if line_thin: args.append("--line_thin")
return self.run_tool('find_ridges', args, callback) # returns 1 if error

def geomorphons(self, dem, output, search=3, threshold=0.0, tdist=0, forms=False, callback=None):
"""Computes geomorphon patterns.
Keyword arguments:
dem -- Input raster DEM file.
output -- Output raster file.
search -- Look up distance.
threshold -- Flatness threshold for the classification function (in degrees).
tdist -- Distance (in cells) to begin reducing the flatness threshold to avoid problems with pseudo-flat lines-of-sight.
forms -- Classify geomorphons into 10 common land morphologies, else, output ternary code.
callback -- Custom function for handling tool text outputs.
"""
args = []
args.append("--dem='{}'".format(dem))
args.append("--output='{}'".format(output))
args.append("--search={}".format(search))
args.append("--threshold={}".format(threshold))
args.append("--tdist={}".format(tdist))
if forms: args.append("--forms")
return self.run_tool('geomorphons', args, callback) # returns 1 if error

def hillshade(self, dem, output, azimuth=315.0, altitude=30.0, zfactor=1.0, callback=None):
"""Calculates a hillshade raster from an input DEM.
Expand Down Expand Up @@ -2825,6 +2840,20 @@ def standard_deviation_of_slope(self, i, output, zfactor=1.0, filterx=11, filter
args.append("--filtery={}".format(filtery))
return self.run_tool('standard_deviation_of_slope', args, callback) # returns 1 if error

def surface_area_ratio(self, dem, output, callback=None):
"""Calculates a the surface area ratio of each grid cell in an input DEM.
Keyword arguments:
dem -- Input raster DEM file.
output -- Output raster file.
callback -- Custom function for handling tool text outputs.
"""
args = []
args.append("--dem='{}'".format(dem))
args.append("--output='{}'".format(output))
return self.run_tool('surface_area_ratio', args, callback) # returns 1 if error

def tangential_curvature(self, dem, output, zfactor=1.0, callback=None):
"""Calculates a tangential curvature raster from an input DEM.
Expand Down Expand Up @@ -6488,7 +6517,7 @@ def raster_histogram(self, i, output, callback=None):
return self.run_tool('raster_histogram', args, callback) # returns 1 if error

def raster_summary_stats(self, i, callback=None):
"""Measures a rasters average, standard deviation, num. non-nodata cells, and total.
"""Measures a rasters min, max, average, standard deviation, num. non-nodata cells, and total.
Keyword arguments:
Expand Down

0 comments on commit 3558912

Please sign in to comment.