Skip to content

Commit d611073

Browse files
authored
Merge pull request #36 from giswqs/develop
Update WBT backend to v1.5.0
2 parents db6baa2 + 6441f90 commit d611073

File tree

534 files changed

+13713
-6126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

534 files changed

+13713
-6126
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ vignettes/*.tif
1212
vignettes/*.log
1313
*.tif
1414
.vscode/
15+
WhiteboxTools_linux_amd64.zip

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Package: whitebox
22
Type: Package
33
Title: 'WhiteboxTools' R Frontend
4-
Version: 1.4.0
4+
Version: 1.5.0
55
Description: An R frontend of 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: person("Qiusheng", "Wu", email = "giswqs@gmail.com", role = c("aut", "cre"))
77
Maintainer: Qiusheng Wu <giswqs@gmail.com>
88
License: MIT + file LICENSE
99
Encoding: UTF-8
1010
LazyData: true
11-
RoxygenNote: 7.1.0
11+
RoxygenNote: 7.1.1
1212
URL: https://github.com/giswqs/whiteboxR
1313
BugReports: https://github.com/giswqs/whiteboxR/issues
1414
Suggests:

NAMESPACE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export(wbt_arsinh)
1515
export(wbt_artanh)
1616
export(wbt_ascii_to_las)
1717
export(wbt_aspect)
18+
export(wbt_assess_route)
1819
export(wbt_atan2)
1920
export(wbt_attribute_correlation)
2021
export(wbt_attribute_correlation_neighbourhood_analysis)
@@ -35,6 +36,7 @@ export(wbt_breach_depressions_least_cost)
3536
export(wbt_breach_single_cell_pits)
3637
export(wbt_buffer_raster)
3738
export(wbt_burn_streams_at_roads)
39+
export(wbt_canny_edge_detection)
3840
export(wbt_ceil)
3941
export(wbt_centroid)
4042
export(wbt_centroid_vector)
@@ -103,13 +105,15 @@ export(wbt_elevation_above_stream)
103105
export(wbt_elevation_above_stream_euclidean)
104106
export(wbt_eliminate_coincident_points)
105107
export(wbt_elongation_ratio)
108+
export(wbt_embankment_mapping)
106109
export(wbt_emboss_filter)
107110
export(wbt_equal_to)
108111
export(wbt_erase)
109112
export(wbt_erase_polygon_from_lidar)
110113
export(wbt_erase_polygon_from_raster)
111114
export(wbt_euclidean_allocation)
112115
export(wbt_euclidean_distance)
116+
export(wbt_evaluate_training_sites)
113117
export(wbt_exe_path)
114118
export(wbt_exp)
115119
export(wbt_exp2)
@@ -174,6 +178,8 @@ export(wbt_image_autocorrelation)
174178
export(wbt_image_correlation)
175179
export(wbt_image_correlation_neighbourhood_analysis)
176180
export(wbt_image_regression)
181+
export(wbt_image_segmentation)
182+
export(wbt_image_slider)
177183
export(wbt_image_stack_profile)
178184
export(wbt_impoundment_size_index)
179185
export(wbt_in_place_add)
@@ -186,6 +192,7 @@ export(wbt_insert_dams)
186192
export(wbt_integer_division)
187193
export(wbt_integral_image)
188194
export(wbt_intersect)
195+
export(wbt_inverse_principal_component_analysis)
189196
export(wbt_is_no_data)
190197
export(wbt_isobasins)
191198
export(wbt_jenson_snap_pour_points)
@@ -229,6 +236,8 @@ export(wbt_lidar_remove_outliers)
229236
export(wbt_lidar_rooftop_analysis)
230237
export(wbt_lidar_segmentation)
231238
export(wbt_lidar_segmentation_based_filter)
239+
export(wbt_lidar_sibson_interpolation)
240+
export(wbt_lidar_sort_by_time)
232241
export(wbt_lidar_thin)
233242
export(wbt_lidar_thin_high_density)
234243
export(wbt_lidar_tile)
@@ -248,6 +257,7 @@ export(wbt_log2)
248257
export(wbt_long_profile)
249258
export(wbt_long_profile_from_points)
250259
export(wbt_longest_flowpath)
260+
export(wbt_low_points_on_headwater_divides)
251261
export(wbt_lowest_position)
252262
export(wbt_majority_filter)
253263
export(wbt_map_off_terrain_objects)
@@ -272,6 +282,7 @@ export(wbt_merge_table_with_csv)
272282
export(wbt_merge_vectors)
273283
export(wbt_min)
274284
export(wbt_min_absolute_overlay)
285+
export(wbt_min_dist_classification)
275286
export(wbt_min_downslope_elev_change)
276287
export(wbt_min_max_contrast_stretch)
277288
export(wbt_min_overlay)
@@ -308,9 +319,11 @@ export(wbt_num_inflowing_neighbours)
308319
export(wbt_num_upslope_neighbours)
309320
export(wbt_olympic_filter)
310321
export(wbt_opening)
322+
export(wbt_openness)
311323
export(wbt_or)
312324
export(wbt_paired_sample_t_test)
313325
export(wbt_panchromatic_sharpening)
326+
export(wbt_parallelepiped_classification)
314327
export(wbt_patch_orientation)
315328
export(wbt_pennock_landform_class)
316329
export(wbt_percent_elev_range)
@@ -320,6 +333,7 @@ export(wbt_percent_less_than)
320333
export(wbt_percentage_contrast_stretch)
321334
export(wbt_percentile_filter)
322335
export(wbt_perimeter_area_ratio)
336+
export(wbt_phi_coefficient)
323337
export(wbt_pick_from_list)
324338
export(wbt_plan_curvature)
325339
export(wbt_polygon_area)
@@ -355,6 +369,7 @@ export(wbt_reciprocal)
355369
export(wbt_reclass)
356370
export(wbt_reclass_equal_interval)
357371
export(wbt_reclass_from_file)
372+
export(wbt_recreate_pass_lines)
358373
export(wbt_reinitialize_attribute_table)
359374
export(wbt_related_circumscribing_circle)
360375
export(wbt_relative_aspect)
@@ -376,6 +391,7 @@ export(wbt_scharr_filter)
376391
export(wbt_sediment_transport_index)
377392
export(wbt_select_tiles_by_polygon)
378393
export(wbt_set_nodata_value)
394+
export(wbt_shadow_animation)
379395
export(wbt_shape_complexity_index)
380396
export(wbt_shape_complexity_index_raster)
381397
export(wbt_shreve_stream_magnitude)
@@ -387,10 +403,12 @@ export(wbt_sink)
387403
export(wbt_slope)
388404
export(wbt_slope_vs_elevation_plot)
389405
export(wbt_smooth_vectors)
406+
export(wbt_smooth_vegetation_residual)
390407
export(wbt_snap_pour_points)
391408
export(wbt_sobel_filter)
392409
export(wbt_spherical_std_dev_of_normals)
393410
export(wbt_split_colour_composite)
411+
export(wbt_split_vector_lines)
394412
export(wbt_split_with_lines)
395413
export(wbt_square)
396414
export(wbt_square_root)
@@ -423,6 +441,7 @@ export(wbt_tool_help)
423441
export(wbt_tool_parameters)
424442
export(wbt_toolbox)
425443
export(wbt_tophat_transform)
444+
export(wbt_topographic_position_animation)
426445
export(wbt_topological_stream_order)
427446
export(wbt_total_curvature)
428447
export(wbt_total_filter)
@@ -455,6 +474,8 @@ export(wbt_wetness_index)
455474
export(wbt_wilcoxon_signed_rank_test)
456475
export(wbt_write_function_memory_insertion)
457476
export(wbt_xor)
477+
export(wbt_yield_filter)
478+
export(wbt_yield_map)
458479
export(wbt_z_scores)
459480
export(wbt_zlidar_to_las)
460481
export(wbt_zonal_statistics)

PY2R/automation.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Step 2 - Create a new develop branch: git checkout -b develop
55
# Step 3 - Delete the old WhiteboxTools_linux_amd64.tar.xz in the root folder if needed
66
# Step 4 - Run automation.py
7-
# Step 5 - Update version number in DESCRIPTION
7+
# Step 5 - Update version number and RoxygenNote in DESCRIPTION
88
# Step 6 - Open whiteboxR.Rproj in RStudio and run build_check.R
99
# Step 7 - Commit and push changes
1010
# Step 8 - Test installation from GitHub: devtools::install_github("giswqs/whiteboxR@develop")
@@ -16,7 +16,7 @@
1616

1717
import os
1818
import shutil
19-
import tarfile
19+
import zipfile
2020
import urllib.request
2121

2222
# Extract function header
@@ -211,6 +211,7 @@ def function_example(fun_name):
211211
"# Image Processing Tools #": "image_analysis.R",
212212
"# LiDAR Tools #": "lidar_analysis.R",
213213
"# Math and Stats Tools #": "math_stat_analysis.R",
214+
"# Precision Agriculture #": "precision_agriculture.R",
214215
"# Stream Network Analysis #": "stream_network_analysis.R"
215216
}
216217

@@ -219,11 +220,11 @@ def function_example(fun_name):
219220
root_dir = os.path.dirname(dir_path)
220221
WBT_dir = os.path.join(root_dir, 'WBT')
221222

222-
linux_tar = "WhiteboxTools_linux_amd64.tar.xz"
223+
linux_tar = "WhiteboxTools_linux_amd64.zip"
223224
tar_path = os.path.join(root_dir, linux_tar)
224225
if not os.path.exists(tar_path):
225226
print("Downloading WhiteboxTools binary ...")
226-
url = "https://jblindsay.github.io/ghrg/WhiteboxTools/WhiteboxTools_linux_amd64.tar.xz"
227+
url = "https://www.whiteboxgeo.com/WBT_Linux/WhiteboxTools_linux_amd64.zip"
227228
urllib.request.urlretrieve(url, tar_path) # Download WhiteboxTools
228229
else:
229230
print("WhiteboxTools binary already exists.")
@@ -232,7 +233,7 @@ def function_example(fun_name):
232233
shutil.rmtree(WBT_dir)
233234

234235
print("Decompressing {} ...".format(linux_tar))
235-
with tarfile.open(tar_path, "r") as tar_ref:
236+
with zipfile.ZipFile(tar_path, "r") as tar_ref:
236237
tar_ref.extractall(root_dir)
237238

238239
shutil.copyfile(os.path.join(WBT_dir, "whitebox_tools.py"), wbt_py)

PY2R/scripts/gis_analysis.R

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,38 @@ wbt_smooth_vectors <- function(input, output, filter=3, wd=NULL, verbose_mode=FA
13521352
}
13531353

13541354

1355+
#' Split vector lines
1356+
#'
1357+
#' This tool can be used to approximate the harvester pass lines from yield points.
1358+
#'
1359+
#' @param input Name of the input lines shapefile.
1360+
#' @param output Name of the output lines shapefile.
1361+
#' @param length Maximum segment length (m).
1362+
#' @param wd Changes the working directory.
1363+
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
1364+
#' @param compress_rasters Sets the flag used by WhiteboxTools to determine whether to use compression for output rasters.
1365+
#'
1366+
#' @return Returns the tool text outputs.
1367+
#' @export
1368+
wbt_split_vector_lines <- function(input, output, length=NULL, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
1369+
wbt_init()
1370+
args <- ""
1371+
args <- paste(args, paste0("--input=", input))
1372+
args <- paste(args, paste0("--output=", output))
1373+
if (!is.null(length)) {
1374+
args <- paste(args, paste0("--length=", length))
1375+
}
1376+
if (!is.null(wd)) {
1377+
args <- paste(args, paste0("--wd=", wd))
1378+
}
1379+
if (compress_rasters) {
1380+
args <- paste(args, "--compress_rasters")
1381+
}
1382+
tool_name <- as.character(match.call()[[1]])
1383+
wbt_run_tool(tool_name, args, verbose_mode)
1384+
}
1385+
1386+
13551387
#' Tin gridding
13561388
#'
13571389
#' Creates a raster grid based on a triangular irregular network (TIN) fitted to vector points.

PY2R/scripts/hydro_analysis.R

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,18 +503,22 @@ wbt_depth_in_sink <- function(dem, output, zero_background=FALSE, wd=NULL, verbo
503503
#' @param dem Input raster DEM file.
504504
#' @param streams Input raster streams file.
505505
#' @param output Output raster file.
506+
#' @param dinf Use the D-infinity flow algoirthm instead of D8?.
506507
#' @param wd Changes the working directory.
507508
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
508509
#' @param compress_rasters Sets the flag used by WhiteboxTools to determine whether to use compression for output rasters.
509510
#'
510511
#' @return Returns the tool text outputs.
511512
#' @export
512-
wbt_downslope_distance_to_stream <- function(dem, streams, output, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
513+
wbt_downslope_distance_to_stream <- function(dem, streams, output, dinf=FALSE, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
513514
wbt_init()
514515
args <- ""
515516
args <- paste(args, paste0("--dem=", dem))
516517
args <- paste(args, paste0("--streams=", streams))
517518
args <- paste(args, paste0("--output=", output))
519+
if (dinf) {
520+
args <- paste(args, "--dinf")
521+
}
518522
if (!is.null(wd)) {
519523
args <- paste(args, paste0("--wd=", wd))
520524
}
@@ -1264,6 +1268,36 @@ wbt_longest_flowpath <- function(dem, basins, output, wd=NULL, verbose_mode=FALS
12641268
}
12651269

12661270

1271+
#' Low points on headwater divides
1272+
#'
1273+
#' This tool locates saddle points along ridges within a digital elevation model (DEM).
1274+
#'
1275+
#' @param dem Name of the input DEM raster file.
1276+
#' @param streams Name of the input stream channel raster file.
1277+
#' @param output Name of the output vector file.
1278+
#' @param wd Changes the working directory.
1279+
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
1280+
#' @param compress_rasters Sets the flag used by WhiteboxTools to determine whether to use compression for output rasters.
1281+
#'
1282+
#' @return Returns the tool text outputs.
1283+
#' @export
1284+
wbt_low_points_on_headwater_divides <- function(dem, streams, output, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
1285+
wbt_init()
1286+
args <- ""
1287+
args <- paste(args, paste0("--dem=", dem))
1288+
args <- paste(args, paste0("--streams=", streams))
1289+
args <- paste(args, paste0("--output=", output))
1290+
if (!is.null(wd)) {
1291+
args <- paste(args, paste0("--wd=", wd))
1292+
}
1293+
if (compress_rasters) {
1294+
args <- paste(args, "--compress_rasters")
1295+
}
1296+
tool_name <- as.character(match.call()[[1]])
1297+
wbt_run_tool(tool_name, args, verbose_mode)
1298+
}
1299+
1300+
12671301
#' Max upslope flowpath length
12681302
#'
12691303
#' Measures the maximum length of all upslope flowpaths draining each grid cell.

0 commit comments

Comments
 (0)