-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
2,619 additions
and
485 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The WhiteboxTools User Manual is now available online at: | ||
|
||
https://jblindsay.github.io/wbt_book/index.html | ||
https://www.whiteboxgeo.com/manual/wbt_book/preface.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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,95 @@ | ||
import platform, subprocess | ||
from shutil import copyfile | ||
import os, sys | ||
from shutil import copyfile, copytree, rmtree | ||
|
||
result = subprocess.run(['cargo', '+nightly', 'build', '--release', '--out-dir=\"../WBT/{exe_name}\"', '-Z unstable-options'], stdout=subprocess.PIPE) | ||
print(result.stdout) | ||
# To use this script: | ||
# | ||
# python3 build.py do_clean | ||
# | ||
# Where 'do_clean' is true or false and determines whether or not to clean existing files first. | ||
|
||
# ext = "" | ||
# if platform.system() == 'Windows': | ||
# ext = '.exe' | ||
|
||
# exe_name = f"whitebox_tools{ext}" | ||
# Set the directory variables | ||
app_dir = os.path.dirname(os.path.abspath(__file__)) | ||
output_dir = os.path.join(app_dir, 'WBT') | ||
output_plugin_dir = os.path.join(app_dir, 'WBT/plugins') | ||
plugins_dir = os.path.join(app_dir, 'whitebox-plugins/src') | ||
target_dir = os.path.join(app_dir, 'target/release') | ||
|
||
# src = f"./target/release/{exe_name}" | ||
# dst = f"../WBT/{exe_name}" | ||
# copyfile(src, dst) | ||
if len(sys.argv) > 1: | ||
if "t" in sys.argv[1].lower(): | ||
print("Cleaning old files...") | ||
result = subprocess.run(['cargo', 'clean'], stdout=subprocess.PIPE) | ||
if len(result.stdout) > 0: | ||
print(result.stdout) | ||
|
||
# result = subprocess.run(["pwd"], stdout=subprocess.PIPE) | ||
# print("pwd: ", result.stdout) | ||
if os.path.exists(output_dir): | ||
rmtree(output_dir) | ||
|
||
# result = subprocess.run(["codesign -h"], stdout=subprocess.PIPE) | ||
# print("", result.stdout) | ||
print("Compiling...") | ||
result = subprocess.run(['cargo', 'build', '--release'], stdout=subprocess.PIPE) | ||
if len(result.stdout) > 0: | ||
print(result.stdout) | ||
|
||
# args = [] | ||
# args.append("./WBT/whitebox_tools") | ||
# args.append("-run='recreate_pass_lines'") | ||
# args.append("--inputFile='/Users/johnlindsay/Documents/data/yield/Woodrill_UTM.shp' --yieldFieldName='Yld_Mass_D' --outputFile='/Users/johnlindsay/Documents/data/yield/pass_lines.shp' --outputPointsFile='/Users/johnlindsay/Documents/data/yield/points.shp' --maxChangeInHeading=25.0") | ||
# result = subprocess.run(args, stdout=subprocess.PIPE) | ||
# print(result.stdout) | ||
if not os.path.exists(output_plugin_dir): | ||
os.makedirs(output_plugin_dir) | ||
|
||
|
||
ext = '' | ||
if platform.system() == 'Windows': | ||
ext = '.exe' | ||
|
||
# Copy the whitebox executable over | ||
exe_file = os.path.join(target_dir, 'whitebox_tools') + ext | ||
dst = os.path.join(output_dir, 'whitebox_tools') + ext | ||
copyfile(exe_file, dst) | ||
os.system("chmod 755 " + dst) # grant executable permission | ||
|
||
# Copy the ancillary files | ||
src = os.path.join(app_dir, 'LICENSE.txt') | ||
dst = os.path.join(output_dir, 'LICENSE.txt') | ||
copyfile(src, dst) | ||
|
||
src = os.path.join(app_dir, 'readme.txt') | ||
dst = os.path.join(output_dir, 'readme.txt') | ||
copyfile(src, dst) | ||
|
||
src = os.path.join(app_dir, 'settings.json') | ||
dst = os.path.join(output_dir, 'settings.json') | ||
copyfile(src, dst) | ||
|
||
src = os.path.join(app_dir, 'UserManual.txt') | ||
dst = os.path.join(output_dir, 'UserManual.txt') | ||
copyfile(src, dst) | ||
|
||
src = os.path.join(app_dir, 'wb_runner.py') | ||
dst = os.path.join(output_dir, 'wb_runner.py') | ||
copyfile(src, dst) | ||
os.system("chmod 755 " + dst) # grant executable permission | ||
|
||
src = os.path.join(app_dir, 'whitebox_tools.py') | ||
dst = os.path.join(output_dir, 'whitebox_tools.py') | ||
copyfile(src, dst) | ||
os.system("chmod 755 " + dst) # grant executable permission | ||
|
||
src = os.path.join(app_dir, 'img') | ||
dst = os.path.join(output_dir, 'img') | ||
copytree(src, dst) | ||
|
||
plugins = os.listdir(plugins_dir) | ||
for plugin in plugins: | ||
if ".DS" not in plugin: | ||
print(f'Copying plugin: {plugin}') | ||
|
||
# Copy the json file into the plugins directory | ||
json_file = os.path.join(plugins_dir, plugin, plugin) + '.json' | ||
dst = os.path.join(output_plugin_dir, plugin) + '.json' | ||
copyfile(json_file, dst) | ||
|
||
# Copy the executable file into the plugins directory | ||
exe_file = os.path.join(target_dir, plugin) + ext | ||
dst = os.path.join(output_plugin_dir, plugin) + ext | ||
copyfile(exe_file, dst) | ||
os.system("chmod 755 " + dst) # grant executable permission | ||
|
||
print("Done!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"verbose_mode": true, | ||
"working_directory": "/Users/johnlindsay/Downloads/", | ||
"compress_rasters": true, | ||
"max_procs": -1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
98 changes: 98 additions & 0 deletions
98
whitebox-plugins/src/conditioned_latin_hypercube/conditioned_latin_hypercube.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"tool_name": "ConditionedLatinHypercube", | ||
"exe": "conditioned_latin_hypercube", | ||
"short_description": "Implements conditioned Latin Hypercube sampling.", | ||
"toolbox": "Math and Stats Tools", | ||
"license": "MIT", | ||
"example": ".*EXE_NAME run -i=Raster1.tif;Raster2.tif --output=sites.shp --samples=500", | ||
"parameters": [ | ||
{ | ||
"name": "Input Raster", | ||
"flags": ["-i", "--inputs"], | ||
"description": "Name of the input raster file", | ||
"parameter_type": {"FileList":{"ExistingFile":"Raster"}}, | ||
"default_value": null, | ||
"optional": false | ||
}, | ||
{ | ||
"name": "Output shapefile", | ||
"flags": ["-o", "--output"], | ||
"description": "Output shapefile", | ||
"parameter_type": {"NewFile":{"Vector":"Point"}}, | ||
"default_value": null, | ||
"optional": false | ||
}, | ||
{ | ||
"name": "Number of sample sites", | ||
"flags": ["--samples"], | ||
"description": "Number of sample sites returned", | ||
"parameter_type": "Integer", | ||
"default_value": "500", | ||
"optional": true | ||
}, | ||
{ | ||
"name": "Number of resampling iterations", | ||
"flags": ["--iterations"], | ||
"description": "Maximum iterations (if stopping criteria not reached).", | ||
"parameter_type": "Integer", | ||
"default_value": "25000", | ||
"optional": true | ||
}, | ||
{ | ||
"name": "RNG seed", | ||
"flags": ["--seed"], | ||
"description": "Seed for RNG consistency", | ||
"parameter_type": "Integer", | ||
"default_value": null, | ||
"optional": true | ||
}, | ||
{ | ||
"name": "Random resample probability", | ||
"flags": ["--prob"], | ||
"description": "Probability of random resample or resampling worst strata between [0,1].", | ||
"parameter_type": "Float", | ||
"default_value": "0.5", | ||
"optional": true | ||
}, | ||
{ | ||
"name": "Objective function threshold.", | ||
"flags": ["--threshold"], | ||
"description": "Objective function values below the theshold stop the resampling iterations.", | ||
"parameter_type": "Float", | ||
"default_value": null, | ||
"optional": true | ||
}, | ||
{ | ||
"name": "Initial annealing temperature", | ||
"flags": ["--temp"], | ||
"description": "Initial annealing temperature between [0,1].", | ||
"parameter_type": "Float", | ||
"default_value": "1.0", | ||
"optional": true | ||
}, | ||
{ | ||
"name": "Temperature decay factor", | ||
"flags": ["--temp_decay"], | ||
"description": "Annealing temperature decay proportion between [0,1]. Reduce temperature by this proportion each annealing cycle.", | ||
"parameter_type": "Float", | ||
"default_value": "0.05", | ||
"optional": true | ||
}, | ||
{ | ||
"name": "Annealing cycle duration", | ||
"flags": ["--cycle"], | ||
"description": "Number of iterations before decaying annealing temperature.", | ||
"parameter_type": "Integer", | ||
"default_value": "10", | ||
"optional": true | ||
}, | ||
{ | ||
"name": "Average the continuous Obj. Func.", | ||
"flags": ["--average"], | ||
"description": "Weight the continuous objective funtion by the 1/N contributing strata.", | ||
"parameter_type": "Boolean", | ||
"default_value": "false", | ||
"optional": true | ||
} | ||
] | ||
} |
Oops, something went wrong.