Skip to content

Commit

Permalink
prep for v2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jblindsay committed Oct 23, 2022
1 parent 739c685 commit 054f759
Show file tree
Hide file tree
Showing 34 changed files with 2,619 additions and 485 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion UserManual.txt
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.
105 changes: 85 additions & 20 deletions build.py
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!")
15 changes: 13 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ for more details.
******************
* Release Notes: *
******************
Version 2.X.X (XX-XX-20XX)

Version 2.2.0 (23-10-2022)
- Added the TravellingSalesmanProblem tool for identifying short routes connecting multiple locations.
- Added the HeatMap tool for performing kernel density estimation (KDE) from vector points.
- Added the MultiplyOverlay tool.
- Added the MaxUpslopeValue tool.
- Added the ConditionedLatinHypercube tool for stratified random sampling (credit Dr. Dan Newman).
- Added the HighPassBilateralFilter tool, useful for emphasizing image texture.
- Fixed a bug with the DirectDecorrelationStretch tool.
- Fixed a bug in the automatic install of the Whitebox extensions that affected Windows users.
- Fixed a bug with the persistence of the compress_rasters parameter. Python users were unable to
turn off the compress flag previously.
Expand All @@ -79,7 +83,14 @@ Version 2.X.X (XX-XX-20XX)
- Fixed a bug with the ConstructVectorTIN tool that resulted in an error when no field data are used.
- Modified the code for writing to the settings.json file so that rather than issuing an error when
the app doesn't have write permission, it simply prints a warning and carries on.
- Fixed bugs in the Geomorphons tool (submitted by Dan Newman).
- Fixed bugs in the Geomorphons tool (submitted by Dr. Dan Newman).
- Fixed a bug with the writing of PolyLineZ vectors.
- Updated the Hillshade, MultidirectionalHillshade, and RelativeAspect tools to use the more robust
5x5 3rd order bivariate polynomial method of Florinsky (2016) for rectangular grid DEMs, and the
3x3 method, also described by Florinsky (2016), for DEMs in geographic coordinates. This is a large
improvement in accuracy for calculating these surface morphology parameters on geographic coordinates
compared with the 'z-conversion fudge factor' method used previously.
- Added support for Apple Silicon; you can now download WhiteboxTools binaries compiled on an M1 Mac.

Version 2.1.0 (30-01-2022)
- The Geomorphons tool for landform classification is now available.
Expand Down
6 changes: 6 additions & 0 deletions settings.json
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
}
4 changes: 3 additions & 1 deletion whitebox-common/src/structures/array2d.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/////////////////////////////////////////////
// A generic 2-dimensional array structure //
/////////////////////////////////////////////

use std::io::Error;
use std::io::ErrorKind;
use std::ops::{AddAssign, Index, IndexMut, SubAssign};


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

impl<T: Copy> IndexMut<(isize, isize)> for Array2D<T>
where
T: Copy + AddAssign + SubAssign,
T: Copy + AddAssign + SubAssign + PartialEq,
{
fn index_mut<'a>(&'a mut self, index: (isize, isize)) -> &'a mut T {
let row = index.0;
Expand Down
Binary file modified whitebox-plugins/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions whitebox-plugins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ edition = "2021"
name = "conditional_evaluation"
path = "src/conditional_evaluation/main.rs"

[[bin]]
name = "conditioned_latin_hypercube"
path = "src/conditioned_latin_hypercube/main.rs"

[[bin]]
name = "edge_contamination"
path = "src/edge_contamination/main.rs"
Expand Down
Binary file modified whitebox-plugins/src/.DS_Store
Binary file not shown.
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
}
]
}
Loading

0 comments on commit 054f759

Please sign in to comment.