Skip to content

Commit 2cea642

Browse files
authored
Merge pull request #124 from brownag/master
whitebox 2.4.0
2 parents 9edd3a4 + c504f56 commit 2cea642

32 files changed

+106
-103
lines changed

.Rbuildignore

+2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
^data-raw$
1919
^revdep$
2020
^_pkgdown\.yml$
21+
WhiteboxTools_linux_amd64/
2122
WBT/
2223
CRAN/
2324
PY2R/
2425
binder/
2526
docs/
2627
misc/
2728
.vscode/
29+
^LICENSE\.md$

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ whiteboxR.Rproj
1919
*.tif
2020
settings.json
2121
__MACOSX
22+
WhiteboxTools_linux_amd64

DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: whitebox
22
Type: Package
33
Title: 'WhiteboxTools' R Frontend
4-
Version: 2.3.4
4+
Version: 2.4.0
55
Description: An R frontend for the 'WhiteboxTools' library, which is an advanced geospatial data analysis platform developed by Prof. John Lindsay at the University of Guelph's Geomorphometry and Hydrogeomatics Research Group. 'WhiteboxTools' can be used to perform common geographical information systems (GIS) analysis operations, such as cost-distance analysis, distance buffering, and raster reclassification. Remote sensing and image processing tasks include image enhancement (e.g. panchromatic sharpening, contrast adjustments), image mosaicing, numerous filtering operations, simple classification (k-means), and common image transformations. 'WhiteboxTools' also contains advanced tooling for spatial hydrological analysis (e.g. flow-accumulation, watershed delineation, stream network analysis, sink removal), terrain analysis (e.g. common terrain indices such as slope, curvatures, wetness index, hillshading; hypsometric analysis; multi-scale topographic position analysis), and LiDAR data processing. Suggested citation: Lindsay (2016) <doi:10.1016/j.cageo.2016.07.003>.
66
Authors@R: c(person("Qiusheng", "Wu", email = "[email protected]", role = c("aut")),
77
person("Andrew", "Brown", email = "[email protected]", role = c("ctb", "cre")))
@@ -10,7 +10,7 @@ License: MIT + file LICENSE
1010
SystemRequirements: WhiteboxTools (https://github.com/jblindsay/whitebox-tools/releases/latest)
1111
Encoding: UTF-8
1212
Language: en-US
13-
RoxygenNote: 7.2.3
13+
RoxygenNote: 7.3.1
1414
Roxygen: list(markdown = TRUE)
1515
URL: https://whiteboxr.gishub.org/, https://github.com/opengeos/whiteboxR
1616
BugReports: https://github.com/opengeos/whiteboxR/issues

Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RUN install2.r --error \
2929
devtools \
3030
whitebox \
3131
Rcpp \
32+
Matrix \
3233
terra \
3334
sf \
3435
ggplot2 \
@@ -38,6 +39,4 @@ RUN install2.r --error \
3839
caTools \
3940
rprojroot
4041

41-
COPY misc/install.R /home/rstudio/
42-
43-
RUN Rscript /home/rstudio/install.R
42+
RUN Rscript -e "whitebox::install_whitebox()"

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2019
2-
COPYRIGHT HOLDER: Qiusheng Wu
1+
YEAR: 2024
2+
COPYRIGHT HOLDER: whitebox authors

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2024 whitebox authors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NEWS.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# whitebox 2.4.0
2+
3+
* Updates for WhiteboxTools v2.4.0 (https://github.com/jblindsay/whitebox-tools/releases/tag/v2.4.0)
4+
5+
* Fix for new ZIP file folder structure for WhiteboxTools v2.4.0+ in `wbt_install()` / `install_whitebox()`
6+
17
# whitebox 2.3.4
28

39
* Exported `wbt_file_path()`, a function previously used internally for creating safe, expanded, quoted, paths for building WhiteboxTools commands. This function also supports the input of `terra` objects that are backed by file sources supported by WhiteboxTools.

PY2R/automation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def function_example(fun_name):
271271
dir_path = os.path.dirname(os.path.realpath(__file__))
272272
wbt_py = os.path.join(dir_path, "whitebox_tools.py")
273273
root_dir = os.path.dirname(dir_path)
274-
WBT_dir = os.path.join(root_dir, "WBT")
274+
WBT_dir = os.path.join(root_dir, "WhiteboxTools_linux_amd64", "WBT")
275275

276276
linux_tar = "WhiteboxTools_linux_amd64.zip"
277277
tar_path = os.path.join(root_dir, linux_tar)
@@ -289,7 +289,7 @@ def function_example(fun_name):
289289
with zipfile.ZipFile(tar_path, "r") as tar_ref:
290290
tar_ref.extractall(root_dir)
291291

292-
shutil.copyfile(os.path.join(WBT_dir, "whitebox_tools.py"), wbt_py)
292+
shutil.copyfile(os.path.join( WBT_dir, "whitebox_tools.py"), wbt_py)
293293

294294
# Generate R functions with documentation
295295
ff = None

PY2R/scripts/math_stat_analysis.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,11 @@ wbt_conditional_evaluation <- function(input, output, statement="", true=NULL, f
647647
#' @param iterations Maximum iterations (if stopping criteria not reached).
648648
#' @param seed Seed for RNG consistency.
649649
#' @param prob Probability of random resample or resampling worst strata between `[0,1]`.
650-
#' @param threshold Objective function values below the theshold stop the resampling iterations.
650+
#' @param threshold Objective function values below the threshold stop the resampling iterations.
651651
#' @param temp Initial annealing temperature between `[0,1]`.
652652
#' @param temp_decay Annealing temperature decay proportion between `[0,1]`. Reduce temperature by this proportion each annealing cycle.
653653
#' @param cycle Number of iterations before decaying annealing temperature.
654-
#' @param average Weight the continuous objective funtion by the 1/N contributing strata.
654+
#' @param average Weight the continuous objective function by the 1/N contributing strata.
655655
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
656656
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
657657
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.

PY2R/scripts/stream_network_analysis.R

+1-5
Original file line numberDiff line numberDiff line change
@@ -945,15 +945,11 @@ wbt_tributary_identifier <- function(d8_pntr, streams, output, esri_pntr=FALSE,
945945
#'
946946
#' @return Returns the tool text outputs.
947947
#' @export
948-
wbt_vector_stream_network_analysis <- function(streams, dem, output, cutting_height=10.0, snap=0.1, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
948+
wbt_vector_stream_network_analysis <- function(streams, output, snap=0.1, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
949949
wbt_init()
950950
args <- ""
951951
args <- paste(args, paste0("--streams=", wbt_file_path(streams)))
952-
args <- paste(args, paste0("--dem=", wbt_file_path(dem)))
953952
args <- paste(args, paste0("--output=", wbt_file_path(output)))
954-
if (!is.null(cutting_height)) {
955-
args <- paste(args, paste0("--cutting_height=", cutting_height))
956-
}
957953
if (!is.null(snap)) {
958954
args <- paste(args, paste0("--snap=", snap))
959955
}

PY2R/scripts/terrain_analysis.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ wbt_average_normal_vector_angular_deviation <- function(dem, output, filter=11,
154154
#'
155155
#' @param dem Name of the input raster image file.
156156
#' @param output Name of the output vector lines file.
157-
#' @param threshold Threshold value (0 - infinity but typcially 1 to 5 works well).
157+
#' @param threshold Threshold value (0 - infinity but typically 1 to 5 works well).
158158
#' @param min_length Minimum line length, in grid cells.
159159
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
160160
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.

PY2R/whitebox_tools.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2803,7 +2803,7 @@ def breakline_mapping(self, dem, output, threshold=2.0, min_length=3, callback=N
28032803
28042804
dem -- Name of the input raster image file.
28052805
output -- Name of the output vector lines file.
2806-
threshold -- Threshold value (0 - infinity but typcially 1 to 5 works well).
2806+
threshold -- Threshold value (0 - infinity but typically 1 to 5 works well).
28072807
min_length -- Minimum line length, in grid cells.
28082808
callback -- Custom function for handling tool text outputs.
28092809
"""
@@ -8945,11 +8945,11 @@ def conditioned_latin_hypercube(self, inputs, output, samples=500, iterations=25
89458945
iterations -- Maximum iterations (if stopping criteria not reached).
89468946
seed -- Seed for RNG consistency.
89478947
prob -- Probability of random resample or resampling worst strata between [0,1].
8948-
threshold -- Objective function values below the theshold stop the resampling iterations.
8948+
threshold -- Objective function values below the threshold stop the resampling iterations.
89498949
temp -- Initial annealing temperature between [0,1].
89508950
temp_decay -- Annealing temperature decay proportion between [0,1]. Reduce temperature by this proportion each annealing cycle.
89518951
cycle -- Number of iterations before decaying annealing temperature.
8952-
average -- Weight the continuous objective funtion by the 1/N contributing strata.
8952+
average -- Weight the continuous objective function by the 1/N contributing strata.
89538953
callback -- Custom function for handling tool text outputs.
89548954
"""
89558955
args = []
@@ -10652,7 +10652,7 @@ def tributary_identifier(self, d8_pntr, streams, output, esri_pntr=False, zero_b
1065210652
if zero_background: args.append("--zero_background")
1065310653
return self.run_tool('tributary_identifier', args, callback) # returns 1 if error
1065410654

10655-
def vector_stream_network_analysis(self, streams, dem, output, cutting_height=10.0, snap=0.1, callback=None):
10655+
def vector_stream_network_analysis(self, streams, output, snap=0.1, callback=None):
1065610656
"""This tool performs common stream network analysis operations on an input vector stream file.
1065710657
1065810658
Keyword arguments:

R/math_stat_analysis.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,11 @@ wbt_conditional_evaluation <- function(input, output, statement="", true=NULL, f
647647
#' @param iterations Maximum iterations (if stopping criteria not reached).
648648
#' @param seed Seed for RNG consistency.
649649
#' @param prob Probability of random resample or resampling worst strata between `[0,1]`.
650-
#' @param threshold Objective function values below the theshold stop the resampling iterations.
650+
#' @param threshold Objective function values below the threshold stop the resampling iterations.
651651
#' @param temp Initial annealing temperature between `[0,1]`.
652652
#' @param temp_decay Annealing temperature decay proportion between `[0,1]`. Reduce temperature by this proportion each annealing cycle.
653653
#' @param cycle Number of iterations before decaying annealing temperature.
654-
#' @param average Weight the continuous objective funtion by the 1/N contributing strata.
654+
#' @param average Weight the continuous objective function by the 1/N contributing strata.
655655
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
656656
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
657657
#' @param compress_rasters Sets the flag used by 'WhiteboxTools' to determine whether to use compression for output rasters. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_compress_rasters()` for details.

R/stream_network_analysis.R

+1-7
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,7 @@ wbt_tributary_identifier <- function(d8_pntr, streams, output, esri_pntr=FALSE,
932932
#' @description This tool performs common stream network analysis operations on an input vector stream file.
933933
#'
934934
#' @param streams Name of the input streams vector file.
935-
#' @param dem Name of the input DEM raster file.
936935
#' @param output Name of the output lines shapefile.
937-
#' @param cutting_height Maximum ridge-cutting height (z units).
938936
#' @param snap Snap distance, in xy units (metres).
939937
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
940938
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.
@@ -945,15 +943,11 @@ wbt_tributary_identifier <- function(d8_pntr, streams, output, esri_pntr=FALSE,
945943
#'
946944
#' @return Returns the tool text outputs.
947945
#' @export
948-
wbt_vector_stream_network_analysis <- function(streams, dem, output, cutting_height=10.0, snap=0.1, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
946+
wbt_vector_stream_network_analysis <- function(streams, output, snap=0.1, wd=NULL, verbose_mode=NULL, compress_rasters=NULL, command_only=FALSE) {
949947
wbt_init()
950948
args <- ""
951949
args <- paste(args, paste0("--streams=", wbt_file_path(streams)))
952-
args <- paste(args, paste0("--dem=", wbt_file_path(dem)))
953950
args <- paste(args, paste0("--output=", wbt_file_path(output)))
954-
if (!is.null(cutting_height)) {
955-
args <- paste(args, paste0("--cutting_height=", cutting_height))
956-
}
957951
if (!is.null(snap)) {
958952
args <- paste(args, paste0("--snap=", snap))
959953
}

R/terrain_analysis.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ wbt_average_normal_vector_angular_deviation <- function(dem, output, filter=11,
154154
#'
155155
#' @param dem Name of the input raster image file.
156156
#' @param output Name of the output vector lines file.
157-
#' @param threshold Threshold value (0 - infinity but typcially 1 to 5 works well).
157+
#' @param threshold Threshold value (0 - infinity but typically 1 to 5 works well).
158158
#' @param min_length Minimum line length, in grid cells.
159159
#' @param wd Changes the working directory. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_wd()` for details.
160160
#' @param verbose_mode Sets verbose mode. If verbose mode is `FALSE`, tools will not print output messages. Default: `NULL` will use the value in WhiteboxTools settings, see `wbt_verbose()` for details.

R/wbt.R

+4-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,10 @@ wbt_install <- function(pkg_dir = wbt_data_dir(), platform = NULL, force = FALSE
606606

607607
# unzip to either whitebox package or user specified folder
608608
utils::unzip(exe_zip, exdir = pkg_dir)
609-
609+
ex_dir <- file.path(pkg_dir, gsub("\\.zip$", "", basename(exe_zip)))
610+
file.copy(file.path(ex_dir, "WBT"), pkg_dir, recursive = TRUE)
611+
file.remove(list.files(ex_dir, recursive = TRUE, full.names = TRUE))
612+
610613
# subfolder WBT/whitebox_tools
611614
exe_path_out <- file.path(pkg_dir, "WBT", basename(exe_path))
612615
Sys.chmod(exe_path_out, '755')

README.Rmd

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ knitr::opts_chunk$set(
1818
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/whitebox)](https://cran.r-project.org/package=whitebox)
1919
[![CRAN download count](https://cranlogs.r-pkg.org/badges/grand-total/whitebox)](https://cranlogs.r-pkg.org/badges/grand-total/whitebox)
2020
[![whitebox Manual](https://img.shields.io/badge/docs-HTML-informational)](https://whiteboxR.gishub.org/reference/index.html)
21-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/MIT/)
21+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/MIT)
2222
[![R-CMD-check](https://github.com/opengeos/whiteboxR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/opengeos/whiteboxR/actions/workflows/R-CMD-check.yaml)
2323
[![codecov](https://codecov.io/gh/opengeos/whiteboxR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/opengeos/whiteboxR)
2424
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/brownag/whitebox-r-binder/master?urlpath=rstudio)
25-
[![Donate](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-yellowgreen.svg)](https://www.buymeacoffee.com/giswqs)
25+
[![Donate](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-yellowgreen.svg)](https://buymeacoffee.com/giswqs)
2626
<!-- badges: end -->
2727

2828
**WhiteboxTools** R Frontend.
@@ -37,7 +37,7 @@ This repository is related to the **whitebox** R package for geospatial analysis
3737
* CRAN link: <https://cran.r-project.org/package=whitebox>
3838
* WhiteboxTools: <https://github.com/jblindsay/whitebox-tools>
3939
* User Manual: <https://jblindsay.github.io/wbt_book/>
40-
* Free software: [MIT license](https://opensource.org/license/MIT/)
40+
* Free software: [MIT license](https://opensource.org/license/MIT)
4141

4242

4343
**Contents**
@@ -231,12 +231,12 @@ If you would like to contribute to the project as a developer, follow these inst
231231
4. Push to the branch (git push origin my-new-feature)
232232
5. Create a new Pull Request
233233

234-
Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion in the work shall be licensed as the [MIT license](https://opensource.org/license/MIT/) without any additional terms or conditions.
234+
Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion in the work shall be licensed as the [MIT license](https://opensource.org/license/MIT) without any additional terms or conditions.
235235

236236

237237
## License
238238

239-
The whitebox **R** package is distributed under the [MIT license](https://opensource.org/license/MIT/), a permissive open-source (free software) license.
239+
The whitebox **R** package is distributed under the [MIT license](https://opensource.org/license/MIT), a permissive open-source (free software) license.
240240

241241

242242
## Reporting Bugs

0 commit comments

Comments
 (0)