Skip to content

Commit 16a2bda

Browse files
committed
wbt_*(): Pass through command_only argument to wbt_run_tool()
1 parent 6aca82e commit 16a2bda

21 files changed

+2074
-2074
lines changed

PY2R/automation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def function_block(line, ff):
6767
start = line.find("(") + 1
6868
end = len(line) - 1
6969
argument = line[start:end]
70-
function_head = "wbt_" + function_name + " <- function(" + argument + ") {"
70+
function_head = "wbt_" + function_name + " <- function(" + argument + ", command_only=FALSE) {"
7171
ff.write(function_head + "\n")
7272
ff.write(" wbt_init()" + "\n")
7373
ff.write(' args <- ""' + "\n")
@@ -102,7 +102,7 @@ def function_block(line, ff):
102102

103103
ff.write(" tool_name <- \""+function_name+"\"\n")
104104
# ff.write(' tool_name <- tool_name[!grepl("(whitebox|::)", tool_name)]' + "\n")
105-
ff.write(" wbt_run_tool(tool_name, args, verbose_mode)" + "\n")
105+
ff.write(" wbt_run_tool(tool_name, args, verbose_mode, command_only)" + "\n")
106106
ff.write("}" + "\n")
107107
ff.write("\n\n")
108108

PY2R/scripts/data_tools.R

Lines changed: 52 additions & 52 deletions
Large diffs are not rendered by default.

PY2R/scripts/gis_analysis.R

Lines changed: 180 additions & 180 deletions
Large diffs are not rendered by default.

PY2R/scripts/hydro_analysis.R

Lines changed: 114 additions & 114 deletions
Large diffs are not rendered by default.

PY2R/scripts/image_analysis.R

Lines changed: 146 additions & 146 deletions
Large diffs are not rendered by default.

PY2R/scripts/lidar_analysis.R

Lines changed: 108 additions & 108 deletions
Large diffs are not rendered by default.

PY2R/scripts/machine_learning.R

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#'
1414
#' @return Returns the tool text outputs.
1515
#' @export
16-
wbt_dbscan <- function(inputs, output, scaling="Normalize", search_dist=0.01, min_points=5, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
16+
wbt_dbscan <- function(inputs, output, scaling="Normalize", search_dist=0.01, min_points=5, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
1717
wbt_init()
1818
args <- ""
1919
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -34,7 +34,7 @@ wbt_dbscan <- function(inputs, output, scaling="Normalize", search_dist=0.01, mi
3434
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
3535
}
3636
tool_name <- "dbscan"
37-
wbt_run_tool(tool_name, args, verbose_mode)
37+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
3838
}
3939

4040

@@ -56,7 +56,7 @@ wbt_dbscan <- function(inputs, output, scaling="Normalize", search_dist=0.01, mi
5656
#'
5757
#' @return Returns the tool text outputs.
5858
#' @export
59-
wbt_k_means_clustering <- function(inputs, output, classes, out_html=NULL, max_iterations=10, class_change=2.0, initialize="diagonal", min_class_size=10, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
59+
wbt_k_means_clustering <- function(inputs, output, classes, out_html=NULL, max_iterations=10, class_change=2.0, initialize="diagonal", min_class_size=10, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
6060
wbt_init()
6161
args <- ""
6262
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -84,7 +84,7 @@ wbt_k_means_clustering <- function(inputs, output, classes, out_html=NULL, max_i
8484
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
8585
}
8686
tool_name <- "k_means_clustering"
87-
wbt_run_tool(tool_name, args, verbose_mode)
87+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
8888
}
8989

9090

@@ -106,7 +106,7 @@ wbt_k_means_clustering <- function(inputs, output, classes, out_html=NULL, max_i
106106
#'
107107
#' @return Returns the tool text outputs.
108108
#' @export
109-
wbt_knn_classification <- function(inputs, training, field, output, scaling="Normalize", k=5, clip=TRUE, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
109+
wbt_knn_classification <- function(inputs, training, field, output, scaling="Normalize", k=5, clip=TRUE, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
110110
wbt_init()
111111
args <- ""
112112
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -132,7 +132,7 @@ wbt_knn_classification <- function(inputs, training, field, output, scaling="Nor
132132
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
133133
}
134134
tool_name <- "knn_classification"
135-
wbt_run_tool(tool_name, args, verbose_mode)
135+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
136136
}
137137

138138

@@ -154,7 +154,7 @@ wbt_knn_classification <- function(inputs, training, field, output, scaling="Nor
154154
#'
155155
#' @return Returns the tool text outputs.
156156
#' @export
157-
wbt_knn_regression <- function(inputs, training, field, scaling="Normalize", output=NULL, k=5, weight=TRUE, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
157+
wbt_knn_regression <- function(inputs, training, field, scaling="Normalize", output=NULL, k=5, weight=TRUE, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
158158
wbt_init()
159159
args <- ""
160160
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -182,7 +182,7 @@ wbt_knn_regression <- function(inputs, training, field, scaling="Normalize", out
182182
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
183183
}
184184
tool_name <- "knn_regression"
185-
wbt_run_tool(tool_name, args, verbose_mode)
185+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
186186
}
187187

188188

@@ -202,7 +202,7 @@ wbt_knn_regression <- function(inputs, training, field, scaling="Normalize", out
202202
#'
203203
#' @return Returns the tool text outputs.
204204
#' @export
205-
wbt_logistic_regression <- function(inputs, training, field, scaling="Normalize", output=NULL, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
205+
wbt_logistic_regression <- function(inputs, training, field, scaling="Normalize", output=NULL, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
206206
wbt_init()
207207
args <- ""
208208
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -224,7 +224,7 @@ wbt_logistic_regression <- function(inputs, training, field, scaling="Normalize"
224224
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
225225
}
226226
tool_name <- "logistic_regression"
227-
wbt_run_tool(tool_name, args, verbose_mode)
227+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
228228
}
229229

230230

@@ -245,7 +245,7 @@ wbt_logistic_regression <- function(inputs, training, field, scaling="Normalize"
245245
#'
246246
#' @return Returns the tool text outputs.
247247
#' @export
248-
wbt_modified_k_means_clustering <- function(inputs, output, out_html=NULL, start_clusters=1000, merge_dist=NULL, max_iterations=10, class_change=2.0, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
248+
wbt_modified_k_means_clustering <- function(inputs, output, out_html=NULL, start_clusters=1000, merge_dist=NULL, max_iterations=10, class_change=2.0, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
249249
wbt_init()
250250
args <- ""
251251
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -272,7 +272,7 @@ wbt_modified_k_means_clustering <- function(inputs, output, out_html=NULL, start
272272
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
273273
}
274274
tool_name <- "modified_k_means_clustering"
275-
wbt_run_tool(tool_name, args, verbose_mode)
275+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
276276
}
277277

278278

@@ -295,7 +295,7 @@ wbt_modified_k_means_clustering <- function(inputs, output, out_html=NULL, start
295295
#'
296296
#' @return Returns the tool text outputs.
297297
#' @export
298-
wbt_random_forest_classification <- function(inputs, training, field, output=NULL, split_criterion="Gini", n_trees=500, min_samples_leaf=1, min_samples_split=2, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
298+
wbt_random_forest_classification <- function(inputs, training, field, output=NULL, split_criterion="Gini", n_trees=500, min_samples_leaf=1, min_samples_split=2, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
299299
wbt_init()
300300
args <- ""
301301
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -326,7 +326,7 @@ wbt_random_forest_classification <- function(inputs, training, field, output=NUL
326326
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
327327
}
328328
tool_name <- "random_forest_classification"
329-
wbt_run_tool(tool_name, args, verbose_mode)
329+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
330330
}
331331

332332

@@ -348,7 +348,7 @@ wbt_random_forest_classification <- function(inputs, training, field, output=NUL
348348
#'
349349
#' @return Returns the tool text outputs.
350350
#' @export
351-
wbt_random_forest_regression <- function(inputs, training, field, output=NULL, n_trees=100, min_samples_leaf=1, min_samples_split=2, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
351+
wbt_random_forest_regression <- function(inputs, training, field, output=NULL, n_trees=100, min_samples_leaf=1, min_samples_split=2, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
352352
wbt_init()
353353
args <- ""
354354
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -376,7 +376,7 @@ wbt_random_forest_regression <- function(inputs, training, field, output=NULL, n
376376
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
377377
}
378378
tool_name <- "random_forest_regression"
379-
wbt_run_tool(tool_name, args, verbose_mode)
379+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
380380
}
381381

382382

@@ -399,7 +399,7 @@ wbt_random_forest_regression <- function(inputs, training, field, output=NULL, n
399399
#'
400400
#' @return Returns the tool text outputs.
401401
#' @export
402-
wbt_svm_classification <- function(inputs, training, field, scaling="Normalize", output=NULL, c=200.0, gamma=50.0, tolerance=0.1, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
402+
wbt_svm_classification <- function(inputs, training, field, scaling="Normalize", output=NULL, c=200.0, gamma=50.0, tolerance=0.1, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
403403
wbt_init()
404404
args <- ""
405405
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -430,7 +430,7 @@ wbt_svm_classification <- function(inputs, training, field, scaling="Normalize",
430430
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
431431
}
432432
tool_name <- "svm_classification"
433-
wbt_run_tool(tool_name, args, verbose_mode)
433+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
434434
}
435435

436436

@@ -453,7 +453,7 @@ wbt_svm_classification <- function(inputs, training, field, scaling="Normalize",
453453
#'
454454
#' @return Returns the tool text outputs.
455455
#' @export
456-
wbt_svm_regression <- function(inputs, training, field, scaling="Normalize", output=NULL, c=50.0, eps=10.0, gamma=0.5, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE) {
456+
wbt_svm_regression <- function(inputs, training, field, scaling="Normalize", output=NULL, c=50.0, eps=10.0, gamma=0.5, test_proportion=0.2, wd=NULL, verbose_mode=FALSE, compress_rasters=FALSE, command_only=FALSE) {
457457
wbt_init()
458458
args <- ""
459459
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
@@ -484,7 +484,7 @@ wbt_svm_regression <- function(inputs, training, field, scaling="Normalize", out
484484
args <- paste(args, paste0("--compress_rasters=", compress_rasters))
485485
}
486486
tool_name <- "svm_regression"
487-
wbt_run_tool(tool_name, args, verbose_mode)
487+
wbt_run_tool(tool_name, args, verbose_mode, command_only)
488488
}
489489

490490

0 commit comments

Comments
 (0)