Skip to content

Commit 116bad4

Browse files
authored
Merge pull request #88 from giswqs/v220
whitebox v2.2.0
2 parents 1ede2b6 + c6b7ac0 commit 116bad4

File tree

172 files changed

+9951
-7134
lines changed

Some content is hidden

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

172 files changed

+9951
-7134
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
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.1.5.9000
4+
Version: 2.2.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 = "giswqs@gmail.com", role = c("aut")),
77
person("Andrew", "Brown", email = "brown.andrewg@gmail.com", role = c("ctb", "cre")))

NAMESPACE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export(wbt_boundary_shape_complexity)
3939
export(wbt_breach_depressions)
4040
export(wbt_breach_depressions_least_cost)
4141
export(wbt_breach_single_cell_pits)
42+
export(wbt_breakline_mapping)
4243
export(wbt_buffer_raster)
4344
export(wbt_burn_streams_at_roads)
4445
export(wbt_canny_edge_detection)
@@ -48,16 +49,20 @@ export(wbt_centroid_vector)
4849
export(wbt_change_vector_analysis)
4950
export(wbt_circular_variance_of_aspect)
5051
export(wbt_classify_buildings_in_lidar)
52+
export(wbt_classify_lidar)
5153
export(wbt_classify_overlap_points)
5254
export(wbt_clean_vector)
5355
export(wbt_clip)
5456
export(wbt_clip_lidar_to_polygon)
5557
export(wbt_clip_raster_to_polygon)
5658
export(wbt_closing)
5759
export(wbt_clump)
60+
export(wbt_colourize_based_on_class)
61+
export(wbt_colourize_based_on_point_returns)
5862
export(wbt_compactness_ratio)
5963
export(wbt_compress_rasters)
6064
export(wbt_conditional_evaluation)
65+
export(wbt_conditioned_latin_hypercube)
6166
export(wbt_conservative_smoothing_filter)
6267
export(wbt_construct_vector_tin)
6368
export(wbt_contours_from_points)
@@ -91,6 +96,7 @@ export(wbt_dbscan)
9196
export(wbt_decrement)
9297
export(wbt_default_path)
9398
export(wbt_depth_in_sink)
99+
export(wbt_depth_to_water)
94100
export(wbt_dev_from_mean_elev)
95101
export(wbt_diff_from_mean_elev)
96102
export(wbt_diff_of_gaussian_filter)
@@ -148,6 +154,7 @@ export(wbt_fill_depressions_planchon_and_darboux)
148154
export(wbt_fill_depressions_wang_and_liu)
149155
export(wbt_fill_missing_data)
150156
export(wbt_fill_single_cell_pits)
157+
export(wbt_filter_lidar)
151158
export(wbt_filter_lidar_classes)
152159
export(wbt_filter_lidar_scan_angles)
153160
export(wbt_filter_raster_features_by_area)
@@ -177,8 +184,10 @@ export(wbt_generating_function)
177184
export(wbt_geomorphons)
178185
export(wbt_greater_than)
179186
export(wbt_hack_stream_order)
187+
export(wbt_heat_map)
180188
export(wbt_height_above_ground)
181189
export(wbt_help)
190+
export(wbt_high_pass_bilateral_filter)
182191
export(wbt_high_pass_filter)
183192
export(wbt_high_pass_median_filter)
184193
export(wbt_highest_position)
@@ -246,6 +255,7 @@ export(wbt_lidar_classify_subset)
246255
export(wbt_lidar_colourize)
247256
export(wbt_lidar_contour)
248257
export(wbt_lidar_digital_surface_model)
258+
export(wbt_lidar_eigenvalue_features)
249259
export(wbt_lidar_elevation_slice)
250260
export(wbt_lidar_ground_point_filter)
251261
export(wbt_lidar_hex_binning)
@@ -308,6 +318,7 @@ export(wbt_max_overlay)
308318
export(wbt_max_procs)
309319
export(wbt_max_upslope_elev_change)
310320
export(wbt_max_upslope_flowpath_length)
321+
export(wbt_max_upslope_value)
311322
export(wbt_maximal_curvature)
312323
export(wbt_maximum_filter)
313324
export(wbt_md_inf_flow_accumulation)
@@ -331,13 +342,15 @@ export(wbt_minimum_bounding_envelope)
331342
export(wbt_minimum_convex_hull)
332343
export(wbt_minimum_filter)
333344
export(wbt_modified_k_means_clustering)
345+
export(wbt_modify_lidar)
334346
export(wbt_modify_no_data_value)
335347
export(wbt_modulo)
336348
export(wbt_mosaic)
337349
export(wbt_mosaic_with_feathering)
338350
export(wbt_multi_part_to_single_part)
339351
export(wbt_multidirectional_hillshade)
340352
export(wbt_multiply)
353+
export(wbt_multiply_overlay)
341354
export(wbt_multiscale_elevation_percentile)
342355
export(wbt_multiscale_roughness)
343356
export(wbt_multiscale_roughness_signature)
@@ -375,6 +388,7 @@ export(wbt_percentile_filter)
375388
export(wbt_perimeter_area_ratio)
376389
export(wbt_phi_coefficient)
377390
export(wbt_pick_from_list)
391+
export(wbt_piecewise_contrast_stretch)
378392
export(wbt_plan_curvature)
379393
export(wbt_polygon_area)
380394
export(wbt_polygon_long_axis)
@@ -415,6 +429,7 @@ export(wbt_reclass)
415429
export(wbt_reclass_equal_interval)
416430
export(wbt_reclass_from_file)
417431
export(wbt_reconcile_multiple_headers)
432+
export(wbt_recover_flightline_info)
418433
export(wbt_recreate_pass_lines)
419434
export(wbt_reinitialize_attribute_table)
420435
export(wbt_related_circumscribing_circle)
@@ -461,8 +476,10 @@ export(wbt_smooth_vectors)
461476
export(wbt_smooth_vegetation_residual)
462477
export(wbt_snap_pour_points)
463478
export(wbt_sobel_filter)
479+
export(wbt_sort_lidar)
464480
export(wbt_spherical_std_dev_of_normals)
465481
export(wbt_split_colour_composite)
482+
export(wbt_split_lidar)
466483
export(wbt_split_vector_lines)
467484
export(wbt_split_with_lines)
468485
export(wbt_square)
@@ -503,6 +520,7 @@ export(wbt_topological_stream_order)
503520
export(wbt_total_curvature)
504521
export(wbt_total_filter)
505522
export(wbt_trace_downslope_flowpaths)
523+
export(wbt_travelling_salesman_problem)
506524
export(wbt_trend_surface)
507525
export(wbt_trend_surface_vector_points)
508526
export(wbt_tributary_identifier)

PY2R/automation.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def function_header(line):
3232
line = line.replace(
3333
"callback=None", "wd=NULL, verbose_mode=FALSE, compress_rasters=False"
3434
)
35+
line = line.replace('function=""', 'FUN=""')
3536
line = line.replace("False", "FALSE")
3637
line = line.replace("True", "TRUE")
3738
line = line.replace("None", "NULL")
@@ -110,7 +111,7 @@ def function_block(line, ff):
110111
+ "\n"
111112
)
112113
ff.write(" }" + "\n")
113-
elif "inputs" in para or "variant" in para:
114+
elif "output" in para or "inputs" in para or "variant" in para or "streams" in para or "lakes" in para:
114115
ff.write(" if (!is.null(" + para + ")) {" + "\n")
115116
ff.write(
116117
' args <- paste(args, paste0("--'
@@ -248,9 +249,15 @@ def function_example(fun_name):
248249
toolboxes = {
249250
"# Data Tools #": "data_tools.R",
250251
"# GIS Analysis #": "gis_analysis.R",
252+
"# GIS Analysis/Distance Tools #": "gis_analysis_distance.R",
253+
"# GIS Analysis/Overlay Tools #": "gis_analysis_overlay.R",
254+
"# GIS Analysis/Patch Shape Tools #": "gis_analysis_patch_shape.R",
251255
"# Geomorphometric Analysis #": "terrain_analysis.R",
252256
"# Hydrological Analysis #": "hydro_analysis.R",
253257
"# Image Processing Tools #": "image_analysis.R",
258+
"# Image Processing Tools/Classification #": "image_analysis_classification.R",
259+
"# Image Processing Tools/Filters #": "image_analysis_filters.R",
260+
"# Image Processing Tools/Image Enhancement #": "image_analysis_enhancement.R",
254261
"# LiDAR Tools #": "lidar_analysis.R",
255262
"# Machine Learning #": "machine_learning.R",
256263
"# Math and Stats Tools #": "math_stat_analysis.R",
@@ -290,7 +297,7 @@ def function_example(fun_name):
290297
lines = f.readlines()
291298

292299
for index, line in enumerate(lines):
293-
if index > 566:
300+
if index > 700:
294301
line = line.strip()
295302

296303
# Create an R script for each toolbox
@@ -325,6 +332,12 @@ def function_example(fun_name):
325332
elif ("--" in doc_line) and (
326333
doc_line.startswith("callback") == False
327334
):
335+
# fix expected cross-reference (use code block)
336+
doc_line = doc_line.replace("[0,1]", "`[0,1]`")
337+
# fix reserved keywords used as argument names
338+
if doc_line.startswith("function"):
339+
doc_line = doc_line.replace("function ", "")
340+
doc_line = "FUN " + doc_line
328341
if doc_line.startswith("i --"):
329342
doc_line = doc_line.replace("i --", "input --")
330343
doc_line = doc_line.replace("-- ", "")

PY2R/scripts/data_tools.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,16 @@ wbt_fix_dangling_arcs <- function(input, output, dist="", wd=NULL, verbose_mode=
235235
#'
236236
#' @return Returns the tool text outputs.
237237
#' @export
238-
wbt_join_tables <- function(input1, pkey, input2, fkey, import_field, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
238+
wbt_join_tables <- function(input1, pkey, input2, fkey, import_field=NULL, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
239239
wbt_init()
240240
args <- ""
241241
args <- paste(args, paste0("--input1=", wbt_file_path(input1)))
242242
args <- paste(args, paste0("--pkey=", wbt_file_path(pkey)))
243243
args <- paste(args, paste0("--input2=", wbt_file_path(input2)))
244244
args <- paste(args, paste0("--fkey=", wbt_file_path(fkey)))
245-
args <- paste(args, paste0("--import_field=", wbt_file_path(import_field)))
245+
if (!is.null(import_field)) {
246+
args <- paste(args, paste0("--import_field=", import_field))
247+
}
246248
if (!missing(wd)) {
247249
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
248250
}
@@ -771,7 +773,7 @@ wbt_vector_lines_to_raster <- function(input, output, field="FID", nodata=TRUE,
771773
#' @param input Input vector Points file.
772774
#' @param field Input field name in attribute table.
773775
#' @param output Output raster file.
774-
#' @param assign Assignment operation, where multiple points are in the same grid cell; options include 'first', 'last' (default), 'min', 'max', 'sum'.
776+
#' @param assign Assignment operation, where multiple points are in the same grid cell; options include 'first', 'last' (default), 'min', 'max', 'sum', 'number'.
775777
#' @param nodata Background value to set to NoData. Without this flag, it will be set to 0.0.
776778
#' @param cell_size Optionally specified cell size of output raster. Not used when base raster is specified.
777779
#' @param base Optionally specified input base raster file. Not used when a cell size is specified.

0 commit comments

Comments
 (0)