Skip to content

Commit 054f759

Browse files
committed
prep for v2.2
1 parent 739c685 commit 054f759

34 files changed

+2619
-485
lines changed

.DS_Store

0 Bytes
Binary file not shown.

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UserManual.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The WhiteboxTools User Manual is now available online at:
22

3-
https://jblindsay.github.io/wbt_book/index.html
3+
https://www.whiteboxgeo.com/manual/wbt_book/preface.html
44

55
Please see the manual for details on usage and for descriptions of available tools.
66
The PDF version of the User Manual is no longer distributed along with the software.

build.py

Lines changed: 85 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,95 @@
11
import platform, subprocess
2-
from shutil import copyfile
2+
import os, sys
3+
from shutil import copyfile, copytree, rmtree
34

4-
result = subprocess.run(['cargo', '+nightly', 'build', '--release', '--out-dir=\"../WBT/{exe_name}\"', '-Z unstable-options'], stdout=subprocess.PIPE)
5-
print(result.stdout)
5+
# To use this script:
6+
#
7+
# python3 build.py do_clean
8+
#
9+
# Where 'do_clean' is true or false and determines whether or not to clean existing files first.
610

7-
# ext = ""
8-
# if platform.system() == 'Windows':
9-
# ext = '.exe'
1011

11-
# exe_name = f"whitebox_tools{ext}"
12+
# Set the directory variables
13+
app_dir = os.path.dirname(os.path.abspath(__file__))
14+
output_dir = os.path.join(app_dir, 'WBT')
15+
output_plugin_dir = os.path.join(app_dir, 'WBT/plugins')
16+
plugins_dir = os.path.join(app_dir, 'whitebox-plugins/src')
17+
target_dir = os.path.join(app_dir, 'target/release')
1218

13-
# src = f"./target/release/{exe_name}"
14-
# dst = f"../WBT/{exe_name}"
15-
# copyfile(src, dst)
19+
if len(sys.argv) > 1:
20+
if "t" in sys.argv[1].lower():
21+
print("Cleaning old files...")
22+
result = subprocess.run(['cargo', 'clean'], stdout=subprocess.PIPE)
23+
if len(result.stdout) > 0:
24+
print(result.stdout)
1625

17-
# result = subprocess.run(["pwd"], stdout=subprocess.PIPE)
18-
# print("pwd: ", result.stdout)
26+
if os.path.exists(output_dir):
27+
rmtree(output_dir)
1928

20-
# result = subprocess.run(["codesign -h"], stdout=subprocess.PIPE)
21-
# print("", result.stdout)
29+
print("Compiling...")
30+
result = subprocess.run(['cargo', 'build', '--release'], stdout=subprocess.PIPE)
31+
if len(result.stdout) > 0:
32+
print(result.stdout)
2233

23-
# args = []
24-
# args.append("./WBT/whitebox_tools")
25-
# args.append("-run='recreate_pass_lines'")
26-
# 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")
27-
# result = subprocess.run(args, stdout=subprocess.PIPE)
28-
# print(result.stdout)
34+
if not os.path.exists(output_plugin_dir):
35+
os.makedirs(output_plugin_dir)
36+
37+
38+
ext = ''
39+
if platform.system() == 'Windows':
40+
ext = '.exe'
41+
42+
# Copy the whitebox executable over
43+
exe_file = os.path.join(target_dir, 'whitebox_tools') + ext
44+
dst = os.path.join(output_dir, 'whitebox_tools') + ext
45+
copyfile(exe_file, dst)
46+
os.system("chmod 755 " + dst) # grant executable permission
47+
48+
# Copy the ancillary files
49+
src = os.path.join(app_dir, 'LICENSE.txt')
50+
dst = os.path.join(output_dir, 'LICENSE.txt')
51+
copyfile(src, dst)
52+
53+
src = os.path.join(app_dir, 'readme.txt')
54+
dst = os.path.join(output_dir, 'readme.txt')
55+
copyfile(src, dst)
56+
57+
src = os.path.join(app_dir, 'settings.json')
58+
dst = os.path.join(output_dir, 'settings.json')
59+
copyfile(src, dst)
60+
61+
src = os.path.join(app_dir, 'UserManual.txt')
62+
dst = os.path.join(output_dir, 'UserManual.txt')
63+
copyfile(src, dst)
64+
65+
src = os.path.join(app_dir, 'wb_runner.py')
66+
dst = os.path.join(output_dir, 'wb_runner.py')
67+
copyfile(src, dst)
68+
os.system("chmod 755 " + dst) # grant executable permission
69+
70+
src = os.path.join(app_dir, 'whitebox_tools.py')
71+
dst = os.path.join(output_dir, 'whitebox_tools.py')
72+
copyfile(src, dst)
73+
os.system("chmod 755 " + dst) # grant executable permission
74+
75+
src = os.path.join(app_dir, 'img')
76+
dst = os.path.join(output_dir, 'img')
77+
copytree(src, dst)
78+
79+
plugins = os.listdir(plugins_dir)
80+
for plugin in plugins:
81+
if ".DS" not in plugin:
82+
print(f'Copying plugin: {plugin}')
83+
84+
# Copy the json file into the plugins directory
85+
json_file = os.path.join(plugins_dir, plugin, plugin) + '.json'
86+
dst = os.path.join(output_plugin_dir, plugin) + '.json'
87+
copyfile(json_file, dst)
88+
89+
# Copy the executable file into the plugins directory
90+
exe_file = os.path.join(target_dir, plugin) + ext
91+
dst = os.path.join(output_plugin_dir, plugin) + ext
92+
copyfile(exe_file, dst)
93+
os.system("chmod 755 " + dst) # grant executable permission
2994

3095
print("Done!")

readme.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,15 @@ for more details.
5555
******************
5656
* Release Notes: *
5757
******************
58-
Version 2.X.X (XX-XX-20XX)
58+
59+
Version 2.2.0 (23-10-2022)
5960
- Added the TravellingSalesmanProblem tool for identifying short routes connecting multiple locations.
6061
- Added the HeatMap tool for performing kernel density estimation (KDE) from vector points.
6162
- Added the MultiplyOverlay tool.
6263
- Added the MaxUpslopeValue tool.
64+
- Added the ConditionedLatinHypercube tool for stratified random sampling (credit Dr. Dan Newman).
65+
- Added the HighPassBilateralFilter tool, useful for emphasizing image texture.
66+
- Fixed a bug with the DirectDecorrelationStretch tool.
6367
- Fixed a bug in the automatic install of the Whitebox extensions that affected Windows users.
6468
- Fixed a bug with the persistence of the compress_rasters parameter. Python users were unable to
6569
turn off the compress flag previously.
@@ -79,7 +83,14 @@ Version 2.X.X (XX-XX-20XX)
7983
- Fixed a bug with the ConstructVectorTIN tool that resulted in an error when no field data are used.
8084
- Modified the code for writing to the settings.json file so that rather than issuing an error when
8185
the app doesn't have write permission, it simply prints a warning and carries on.
82-
- Fixed bugs in the Geomorphons tool (submitted by Dan Newman).
86+
- Fixed bugs in the Geomorphons tool (submitted by Dr. Dan Newman).
87+
- Fixed a bug with the writing of PolyLineZ vectors.
88+
- Updated the Hillshade, MultidirectionalHillshade, and RelativeAspect tools to use the more robust
89+
5x5 3rd order bivariate polynomial method of Florinsky (2016) for rectangular grid DEMs, and the
90+
3x3 method, also described by Florinsky (2016), for DEMs in geographic coordinates. This is a large
91+
improvement in accuracy for calculating these surface morphology parameters on geographic coordinates
92+
compared with the 'z-conversion fudge factor' method used previously.
93+
- Added support for Apple Silicon; you can now download WhiteboxTools binaries compiled on an M1 Mac.
8394

8495
Version 2.1.0 (30-01-2022)
8596
- The Geomorphons tool for landform classification is now available.

settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"verbose_mode": true,
3+
"working_directory": "/Users/johnlindsay/Downloads/",
4+
"compress_rasters": true,
5+
"max_procs": -1
6+
}

whitebox-common/src/structures/array2d.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/////////////////////////////////////////////
22
// A generic 2-dimensional array structure //
33
/////////////////////////////////////////////
4+
45
use std::io::Error;
56
use std::io::ErrorKind;
67
use std::ops::{AddAssign, Index, IndexMut, SubAssign};
78

9+
810
/// A simple in-memory 2-D raster data structure that is not connected to a file.
911
/// Pixel values can contain any data type or structure that implements the Copy,
1012
/// AddAssign, and SubAssign traits.
@@ -211,7 +213,7 @@ where
211213

212214
impl<T: Copy> IndexMut<(isize, isize)> for Array2D<T>
213215
where
214-
T: Copy + AddAssign + SubAssign,
216+
T: Copy + AddAssign + SubAssign + PartialEq,
215217
{
216218
fn index_mut<'a>(&'a mut self, index: (isize, isize)) -> &'a mut T {
217219
let row = index.0;

whitebox-plugins/.DS_Store

0 Bytes
Binary file not shown.

whitebox-plugins/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ edition = "2021"
88
name = "conditional_evaluation"
99
path = "src/conditional_evaluation/main.rs"
1010

11+
[[bin]]
12+
name = "conditioned_latin_hypercube"
13+
path = "src/conditioned_latin_hypercube/main.rs"
14+
1115
[[bin]]
1216
name = "edge_contamination"
1317
path = "src/edge_contamination/main.rs"

whitebox-plugins/src/.DS_Store

0 Bytes
Binary file not shown.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"tool_name": "ConditionedLatinHypercube",
3+
"exe": "conditioned_latin_hypercube",
4+
"short_description": "Implements conditioned Latin Hypercube sampling.",
5+
"toolbox": "Math and Stats Tools",
6+
"license": "MIT",
7+
"example": ".*EXE_NAME run -i=Raster1.tif;Raster2.tif --output=sites.shp --samples=500",
8+
"parameters": [
9+
{
10+
"name": "Input Raster",
11+
"flags": ["-i", "--inputs"],
12+
"description": "Name of the input raster file",
13+
"parameter_type": {"FileList":{"ExistingFile":"Raster"}},
14+
"default_value": null,
15+
"optional": false
16+
},
17+
{
18+
"name": "Output shapefile",
19+
"flags": ["-o", "--output"],
20+
"description": "Output shapefile",
21+
"parameter_type": {"NewFile":{"Vector":"Point"}},
22+
"default_value": null,
23+
"optional": false
24+
},
25+
{
26+
"name": "Number of sample sites",
27+
"flags": ["--samples"],
28+
"description": "Number of sample sites returned",
29+
"parameter_type": "Integer",
30+
"default_value": "500",
31+
"optional": true
32+
},
33+
{
34+
"name": "Number of resampling iterations",
35+
"flags": ["--iterations"],
36+
"description": "Maximum iterations (if stopping criteria not reached).",
37+
"parameter_type": "Integer",
38+
"default_value": "25000",
39+
"optional": true
40+
},
41+
{
42+
"name": "RNG seed",
43+
"flags": ["--seed"],
44+
"description": "Seed for RNG consistency",
45+
"parameter_type": "Integer",
46+
"default_value": null,
47+
"optional": true
48+
},
49+
{
50+
"name": "Random resample probability",
51+
"flags": ["--prob"],
52+
"description": "Probability of random resample or resampling worst strata between [0,1].",
53+
"parameter_type": "Float",
54+
"default_value": "0.5",
55+
"optional": true
56+
},
57+
{
58+
"name": "Objective function threshold.",
59+
"flags": ["--threshold"],
60+
"description": "Objective function values below the theshold stop the resampling iterations.",
61+
"parameter_type": "Float",
62+
"default_value": null,
63+
"optional": true
64+
},
65+
{
66+
"name": "Initial annealing temperature",
67+
"flags": ["--temp"],
68+
"description": "Initial annealing temperature between [0,1].",
69+
"parameter_type": "Float",
70+
"default_value": "1.0",
71+
"optional": true
72+
},
73+
{
74+
"name": "Temperature decay factor",
75+
"flags": ["--temp_decay"],
76+
"description": "Annealing temperature decay proportion between [0,1]. Reduce temperature by this proportion each annealing cycle.",
77+
"parameter_type": "Float",
78+
"default_value": "0.05",
79+
"optional": true
80+
},
81+
{
82+
"name": "Annealing cycle duration",
83+
"flags": ["--cycle"],
84+
"description": "Number of iterations before decaying annealing temperature.",
85+
"parameter_type": "Integer",
86+
"default_value": "10",
87+
"optional": true
88+
},
89+
{
90+
"name": "Average the continuous Obj. Func.",
91+
"flags": ["--average"],
92+
"description": "Weight the continuous objective funtion by the 1/N contributing strata.",
93+
"parameter_type": "Boolean",
94+
"default_value": "false",
95+
"optional": true
96+
}
97+
]
98+
}

0 commit comments

Comments
 (0)