Skip to content

Commit 55a6e32

Browse files
authored
Merge pull request #15 from giswqs/develop
Prep for v1.1.0
2 parents 4d87ee7 + 4da8a63 commit 55a6e32

File tree

473 files changed

+5704
-6878
lines changed

Some content is hidden

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

473 files changed

+5704
-6878
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: 1.0.2
4+
Version: 1.1.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>

NAMESPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export(wbt_block_maximum_gridding)
2929
export(wbt_block_minimum_gridding)
3030
export(wbt_boundary_shape_complexity)
3131
export(wbt_breach_depressions)
32+
export(wbt_breach_depressions_least_cost)
3233
export(wbt_breach_single_cell_pits)
3334
export(wbt_buffer_raster)
3435
export(wbt_burn_streams_at_roads)
@@ -37,6 +38,7 @@ export(wbt_centroid)
3738
export(wbt_centroid_vector)
3839
export(wbt_change_vector_analysis)
3940
export(wbt_circular_variance_of_aspect)
41+
export(wbt_classify_buildings_in_lidar)
4042
export(wbt_classify_overlap_points)
4143
export(wbt_clean_vector)
4244
export(wbt_clip)
@@ -121,6 +123,7 @@ export(wbt_feature_preserving_smoothing)
121123
export(wbt_fetch_analysis)
122124
export(wbt_fill_burn)
123125
export(wbt_fill_depressions)
126+
export(wbt_fill_depressions_wang_and_lui)
124127
export(wbt_fill_missing_data)
125128
export(wbt_fill_single_cell_pits)
126129
export(wbt_filter_lidar_classes)
@@ -161,6 +164,7 @@ export(wbt_idw_interpolation)
161164
export(wbt_ihs_to_rgb)
162165
export(wbt_image_autocorrelation)
163166
export(wbt_image_correlation)
167+
export(wbt_image_correlation_neighbourhood_analysis)
164168
export(wbt_image_regression)
165169
export(wbt_image_stack_profile)
166170
export(wbt_impoundment_size_index)
@@ -211,6 +215,7 @@ export(wbt_lidar_point_stats)
211215
export(wbt_lidar_ransac_planes)
212216
export(wbt_lidar_remove_duplicates)
213217
export(wbt_lidar_remove_outliers)
218+
export(wbt_lidar_rfb_interpolation)
214219
export(wbt_lidar_segmentation)
215220
export(wbt_lidar_segmentation_based_filter)
216221
export(wbt_lidar_thin)
@@ -275,6 +280,7 @@ export(wbt_multiscale_std_dev_normals)
275280
export(wbt_multiscale_std_dev_normals_signature)
276281
export(wbt_multiscale_topographic_position_image)
277282
export(wbt_narrowness_index)
283+
export(wbt_natural_neighbour_interpolation)
278284
export(wbt_nearest_neighbour_gridding)
279285
export(wbt_negate)
280286
export(wbt_new_raster_from_base)
@@ -411,6 +417,7 @@ export(wbt_two_sample_ks_test)
411417
export(wbt_union)
412418
export(wbt_unnest_basins)
413419
export(wbt_unsharp_masking)
420+
export(wbt_upslope_depression_storage)
414421
export(wbt_user_defined_weights_filter)
415422
export(wbt_vector_hex_binning)
416423
export(wbt_vector_lines_to_raster)

PY2R/scripts/gis_analysis.R

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,12 @@ wbt_clump <- function(input, output, diag=TRUE, zero_back=FALSE, verbose_mode=FA
174174
#' @param field Input field name in attribute table.
175175
#' @param use_z Use the 'z' dimension of the Shapefile's geometry instead of an attribute field?.
176176
#' @param output Output vector polygon file.
177+
#' @param max_triangle_edge_length Optional maximum triangle edge length; triangles larger than this size will not be gridded.
177178
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
178179
#'
179180
#' @return Returns the tool text outputs.
180181
#' @export
181-
wbt_construct_vector_tin <- function(input, output, field=NULL, use_z=FALSE, verbose_mode=FALSE) {
182+
wbt_construct_vector_tin <- function(input, output, field=NULL, use_z=FALSE, max_triangle_edge_length=NULL, verbose_mode=FALSE) {
182183
wbt_init()
183184
args <- ""
184185
args <- paste(args, paste0("--input=", input))
@@ -189,6 +190,9 @@ wbt_construct_vector_tin <- function(input, output, field=NULL, use_z=FALSE, ver
189190
if (use_z) {
190191
args <- paste(args, "--use_z")
191192
}
193+
if (!is.null(max_triangle_edge_length)) {
194+
args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length))
195+
}
192196
tool_name <- as.character(match.call()[[1]])
193197
wbt_run_tool(tool_name, args, verbose_mode)
194198
}
@@ -614,6 +618,46 @@ wbt_minimum_convex_hull <- function(input, output, features=TRUE, verbose_mode=F
614618
}
615619

616620

621+
#' Natural neighbour interpolation
622+
#'
623+
#' Creates a raster grid based on Sibson's natural neighbour method.
624+
#'
625+
#' @param input Input vector points file.
626+
#' @param field Input field name in attribute table.
627+
#' @param use_z Use the 'z' dimension of the Shapefile's geometry instead of an attribute field?.
628+
#' @param output Output raster file.
629+
#' @param cell_size Optionally specified cell size of output raster. Not used when base raster is specified.
630+
#' @param base Optionally specified input base raster file. Not used when a cell size is specified.
631+
#' @param clip Clip the data to the convex hull of the points?.
632+
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
633+
#'
634+
#' @return Returns the tool text outputs.
635+
#' @export
636+
wbt_natural_neighbour_interpolation <- function(input, output, field=NULL, use_z=FALSE, cell_size=NULL, base=NULL, clip=TRUE, verbose_mode=FALSE) {
637+
wbt_init()
638+
args <- ""
639+
args <- paste(args, paste0("--input=", input))
640+
args <- paste(args, paste0("--output=", output))
641+
if (!is.null(field)) {
642+
args <- paste(args, paste0("--field=", field))
643+
}
644+
if (use_z) {
645+
args <- paste(args, "--use_z")
646+
}
647+
if (!is.null(cell_size)) {
648+
args <- paste(args, paste0("--cell_size=", cell_size))
649+
}
650+
if (!is.null(base)) {
651+
args <- paste(args, paste0("--base=", base))
652+
}
653+
if (clip) {
654+
args <- paste(args, "--clip")
655+
}
656+
tool_name <- as.character(match.call()[[1]])
657+
wbt_run_tool(tool_name, args, verbose_mode)
658+
}
659+
660+
617661
#' Nearest neighbour gridding
618662
#'
619663
#' Creates a raster grid based on a set of vector points and assigns grid values using the nearest neighbour.
@@ -899,22 +943,32 @@ wbt_smooth_vectors <- function(input, output, filter=3, verbose_mode=FALSE) {
899943
#' @param use_z Use the 'z' dimension of the Shapefile's geometry instead of an attribute field?.
900944
#' @param output Output raster file.
901945
#' @param resolution Output raster's grid resolution.
946+
#' @param base Optionally specified input base raster file. Not used when a cell size is specified.
947+
#' @param max_triangle_edge_length Optional maximum triangle edge length; triangles larger than this size will not be gridded.
902948
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
903949
#'
904950
#' @return Returns the tool text outputs.
905951
#' @export
906-
wbt_tin_gridding <- function(input, output, resolution, field=NULL, use_z=FALSE, verbose_mode=FALSE) {
952+
wbt_tin_gridding <- function(input, output, field=NULL, use_z=FALSE, resolution=NULL, base=NULL, max_triangle_edge_length=NULL, verbose_mode=FALSE) {
907953
wbt_init()
908954
args <- ""
909955
args <- paste(args, paste0("--input=", input))
910956
args <- paste(args, paste0("--output=", output))
911-
args <- paste(args, paste0("--resolution=", resolution))
912957
if (!is.null(field)) {
913958
args <- paste(args, paste0("--field=", field))
914959
}
915960
if (use_z) {
916961
args <- paste(args, "--use_z")
917962
}
963+
if (!is.null(resolution)) {
964+
args <- paste(args, paste0("--resolution=", resolution))
965+
}
966+
if (!is.null(base)) {
967+
args <- paste(args, paste0("--base=", base))
968+
}
969+
if (!is.null(max_triangle_edge_length)) {
970+
args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length))
971+
}
918972
tool_name <- as.character(match.call()[[1]])
919973
wbt_run_tool(tool_name, args, verbose_mode)
920974
}

PY2R/scripts/hydro_analysis.R

Lines changed: 122 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,44 @@ wbt_breach_depressions <- function(dem, output, max_depth=NULL, max_length=NULL,
9898
}
9999

100100

101+
#' Breach depressions least cost
102+
#'
103+
#' Breaches the depressions in a DEM using a least-cost pathway method.
104+
#'
105+
#' @param dem Input raster DEM file.
106+
#' @param output Output raster file.
107+
#' @param radius .
108+
#' @param max_cost Optional maximum breach cost (default is Inf).
109+
#' @param min_dist Optional flag indicating whether to minimize breach distances.
110+
#' @param flat_increment Optional elevation increment applied to flat areas.
111+
#' @param fill Optional flag indicating whether to fill any remaining unbreached depressions.
112+
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
113+
#'
114+
#' @return Returns the tool text outputs.
115+
#' @export
116+
wbt_breach_depressions_least_cost <- function(dem, output, radius, max_cost=NULL, min_dist=TRUE, flat_increment=NULL, fill=TRUE, verbose_mode=FALSE) {
117+
wbt_init()
118+
args <- ""
119+
args <- paste(args, paste0("--dem=", dem))
120+
args <- paste(args, paste0("--output=", output))
121+
args <- paste(args, paste0("--radius=", radius))
122+
if (!is.null(max_cost)) {
123+
args <- paste(args, paste0("--max_cost=", max_cost))
124+
}
125+
if (min_dist) {
126+
args <- paste(args, "--min_dist")
127+
}
128+
if (!is.null(flat_increment)) {
129+
args <- paste(args, paste0("--flat_increment=", flat_increment))
130+
}
131+
if (fill) {
132+
args <- paste(args, "--fill")
133+
}
134+
tool_name <- as.character(match.call()[[1]])
135+
wbt_run_tool(tool_name, args, verbose_mode)
136+
}
137+
138+
101139
#' Breach single cell pits
102140
#'
103141
#' Removes single-cell pits from an input DEM by breaching.
@@ -118,6 +156,34 @@ wbt_breach_single_cell_pits <- function(dem, output, verbose_mode=FALSE) {
118156
}
119157

120158

159+
#' Burn streams at roads
160+
#'
161+
#' Burns-in streams at the sites of road embankments.
162+
#'
163+
#' @param dem Input raster digital elevation model (DEM) file.
164+
#' @param streams Input vector streams file.
165+
#' @param roads Input vector roads file.
166+
#' @param output Output raster file.
167+
#' @param width Maximum road embankment width, in map units.
168+
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
169+
#'
170+
#' @return Returns the tool text outputs.
171+
#' @export
172+
wbt_burn_streams_at_roads <- function(dem, streams, roads, output, width=NULL, verbose_mode=FALSE) {
173+
wbt_init()
174+
args <- ""
175+
args <- paste(args, paste0("--dem=", dem))
176+
args <- paste(args, paste0("--streams=", streams))
177+
args <- paste(args, paste0("--roads=", roads))
178+
args <- paste(args, paste0("--output=", output))
179+
if (!is.null(width)) {
180+
args <- paste(args, paste0("--width=", width))
181+
}
182+
tool_name <- as.character(match.call()[[1]])
183+
wbt_run_tool(tool_name, args, verbose_mode)
184+
}
185+
186+
121187
#' D8 flow accumulation
122188
#'
123189
#' Calculates a D8 flow accumulation raster from an input DEM.
@@ -494,11 +560,43 @@ wbt_fill_burn <- function(dem, streams, output, verbose_mode=FALSE) {
494560
#' @param output Output raster file.
495561
#' @param fix_flats Optional flag indicating whether flat areas should have a small gradient applied.
496562
#' @param flat_increment Optional elevation increment applied to flat areas.
563+
#' @param max_depth Optional maximum depression depth to fill.
564+
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
565+
#'
566+
#' @return Returns the tool text outputs.
567+
#' @export
568+
wbt_fill_depressions <- function(dem, output, fix_flats=TRUE, flat_increment=NULL, max_depth=NULL, verbose_mode=FALSE) {
569+
wbt_init()
570+
args <- ""
571+
args <- paste(args, paste0("--dem=", dem))
572+
args <- paste(args, paste0("--output=", output))
573+
if (fix_flats) {
574+
args <- paste(args, "--fix_flats")
575+
}
576+
if (!is.null(flat_increment)) {
577+
args <- paste(args, paste0("--flat_increment=", flat_increment))
578+
}
579+
if (!is.null(max_depth)) {
580+
args <- paste(args, paste0("--max_depth=", max_depth))
581+
}
582+
tool_name <- as.character(match.call()[[1]])
583+
wbt_run_tool(tool_name, args, verbose_mode)
584+
}
585+
586+
587+
#' Fill depressions wang and lui
588+
#'
589+
#' Fills all of the depressions in a DEM. Depression breaching should be preferred in most cases.
590+
#'
591+
#' @param dem Input raster DEM file.
592+
#' @param output Output raster file.
593+
#' @param fix_flats Optional flag indicating whether flat areas should have a small gradient applied.
594+
#' @param flat_increment Optional elevation increment applied to flat areas.
497595
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
498596
#'
499597
#' @return Returns the tool text outputs.
500598
#' @export
501-
wbt_fill_depressions <- function(dem, output, fix_flats=TRUE, flat_increment=NULL, verbose_mode=FALSE) {
599+
wbt_fill_depressions_wang_and_lui <- function(dem, output, fix_flats=TRUE, flat_increment=NULL, verbose_mode=FALSE) {
502600
wbt_init()
503601
args <- ""
504602
args <- paste(args, paste0("--dem=", dem))
@@ -900,17 +998,17 @@ wbt_rho8_pointer <- function(dem, output, esri_pntr=FALSE, verbose_mode=FALSE) {
900998
#'
901999
#' Identifies the depressions in a DEM, giving each feature a unique identifier.
9021000
#'
903-
#' @param dem Input raster DEM file.
1001+
#' @param input Input raster DEM file.
9041002
#' @param output Output raster file.
9051003
#' @param zero_background Flag indicating whether a background value of zero should be used.
9061004
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
9071005
#'
9081006
#' @return Returns the tool text outputs.
9091007
#' @export
910-
wbt_sink <- function(dem, output, zero_background=FALSE, verbose_mode=FALSE) {
1008+
wbt_sink <- function(input, output, zero_background=FALSE, verbose_mode=FALSE) {
9111009
wbt_init()
9121010
args <- ""
913-
args <- paste(args, paste0("--dem=", dem))
1011+
args <- paste(args, paste0("--input=", input))
9141012
args <- paste(args, paste0("--output=", output))
9151013
if (zero_background) {
9161014
args <- paste(args, "--zero_background")
@@ -1080,6 +1178,26 @@ wbt_unnest_basins <- function(d8_pntr, pour_pts, output, esri_pntr=FALSE, verbos
10801178
}
10811179

10821180

1181+
#' Upslope depression storage
1182+
#'
1183+
#' Estimates the average upslope depression storage depth.
1184+
#'
1185+
#' @param dem Input raster DEM file.
1186+
#' @param output Output raster file.
1187+
#' @param verbose_mode Sets verbose mode. If verbose mode is False, tools will not print output messages.
1188+
#'
1189+
#' @return Returns the tool text outputs.
1190+
#' @export
1191+
wbt_upslope_depression_storage <- function(dem, output, verbose_mode=FALSE) {
1192+
wbt_init()
1193+
args <- ""
1194+
args <- paste(args, paste0("--dem=", dem))
1195+
args <- paste(args, paste0("--output=", output))
1196+
tool_name <- as.character(match.call()[[1]])
1197+
wbt_run_tool(tool_name, args, verbose_mode)
1198+
}
1199+
1200+
10831201
#' Watershed
10841202
#'
10851203
#' Identifies the watershed, or drainage basin, draining to a set of target cells.

0 commit comments

Comments
 (0)