diff --git a/Cargo.toml b/Cargo.toml index bd104f673..9e50cbee4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 \ No newline at end of file +# [profile.release] +# opt-level = 3 +# debug = false +# rpath = false +# lto = false +# debug-assertions = false +# codegen-units = 16 +# panic = 'unwind' +# incremental = true +# overflow-checks = false \ No newline at end of file diff --git a/UserManual.txt b/UserManual.txt new file mode 100644 index 000000000..add64a817 --- /dev/null +++ b/UserManual.txt @@ -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. \ No newline at end of file diff --git a/WhiteboxToolsManual.pdf b/WhiteboxToolsManual.pdf deleted file mode 100644 index afc63851c..000000000 Binary files a/WhiteboxToolsManual.pdf and /dev/null differ diff --git a/src/tools/terrain_analysis/edge_density.rs b/src/tools/terrain_analysis/edge_density.rs index 319c3ae2b..ac642843a 100644 --- a/src/tools/terrain_analysis/edge_density.rs +++ b/src/tools/terrain_analysis/edge_density.rs @@ -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` diff --git a/whitebox_tools.py b/whitebox_tools.py index b17189c33..540859916 100644 --- a/whitebox_tools.py +++ b/whitebox_tools.py @@ -365,6 +365,7 @@ def list_tools(self, keywords=[]): + ############## # Data Tools # ############## @@ -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. @@ -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. @@ -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. @@ -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. @@ -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: