Skip to content

Commit c6b7ac0

Browse files
committed
improve path support for optional inputs/outputs
1 parent 7f75d03 commit c6b7ac0

13 files changed

+75
-75
lines changed

PY2R/automation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def function_block(line, ff):
111111
+ "\n"
112112
)
113113
ff.write(" }" + "\n")
114-
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:
115115
ff.write(" if (!is.null(" + para + ")) {" + "\n")
116116
ff.write(
117117
' args <- paste(args, paste0("--'

PY2R/scripts/gis_analysis.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ wbt_raster_area <- function(input, output=NULL, out_text=FALSE, units="grid cell
12011201
args <- ""
12021202
args <- paste(args, paste0("--input=", wbt_file_path(input)))
12031203
if (!is.null(output)) {
1204-
args <- paste(args, paste0("--output=", output))
1204+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
12051205
}
12061206
if (out_text) {
12071207
args <- paste(args, "--out_text")
@@ -1277,7 +1277,7 @@ wbt_raster_perimeter <- function(input, output=NULL, out_text=FALSE, units="grid
12771277
args <- ""
12781278
args <- paste(args, paste0("--input=", wbt_file_path(input)))
12791279
if (!is.null(output)) {
1280-
args <- paste(args, paste0("--output=", output))
1280+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
12811281
}
12821282
if (out_text) {
12831283
args <- paste(args, "--out_text")

PY2R/scripts/hydro_analysis.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,10 @@ wbt_depth_to_water <- function(dem, output, streams=NULL, lakes=NULL, wd=NULL, v
531531
args <- paste(args, paste0("--dem=", wbt_file_path(dem)))
532532
args <- paste(args, paste0("--output=", wbt_file_path(output)))
533533
if (!is.null(streams)) {
534-
args <- paste(args, paste0("--streams=", streams))
534+
args <- paste(args, paste0("--streams=", wbt_file_path(streams)))
535535
}
536536
if (!is.null(lakes)) {
537-
args <- paste(args, paste0("--lakes=", lakes))
537+
args <- paste(args, paste0("--lakes=", wbt_file_path(lakes)))
538538
}
539539
if (!missing(wd)) {
540540
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))

PY2R/scripts/image_analysis.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ wbt_ihs_to_rgb <- function(intensity, hue, saturation, red=NULL, green=NULL, blu
180180
args <- paste(args, paste0("--blue=", blue))
181181
}
182182
if (!is.null(output)) {
183-
args <- paste(args, paste0("--output=", output))
183+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
184184
}
185185
if (!missing(wd)) {
186186
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))

PY2R/scripts/lidar_analysis.R

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ wbt_classify_lidar <- function(input, output=NULL, radius=1.5, grd_threshold=0.1
8787
args <- ""
8888
args <- paste(args, paste0("--input=", wbt_file_path(input)))
8989
if (!is.null(output)) {
90-
args <- paste(args, paste0("--output=", output))
90+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
9191
}
9292
if (!is.null(radius)) {
9393
args <- paste(args, paste0("--radius=", radius))
@@ -215,7 +215,7 @@ wbt_colourize_based_on_class <- function(input, output=NULL, intensity_blending=
215215
args <- ""
216216
args <- paste(args, paste0("--input=", wbt_file_path(input)))
217217
if (!is.null(output)) {
218-
args <- paste(args, paste0("--output=", output))
218+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
219219
}
220220
if (!is.null(intensity_blending)) {
221221
args <- paste(args, paste0("--intensity_blending=", intensity_blending))
@@ -263,7 +263,7 @@ wbt_colourize_based_on_point_returns <- function(input, output=NULL, intensity_b
263263
args <- ""
264264
args <- paste(args, paste0("--input=", wbt_file_path(input)))
265265
if (!is.null(output)) {
266-
args <- paste(args, paste0("--output=", output))
266+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
267267
}
268268
if (!is.null(intensity_blending)) {
269269
args <- paste(args, paste0("--intensity_blending=", intensity_blending))
@@ -345,7 +345,7 @@ wbt_filter_lidar <- function(input, output=NULL, statement="", wd=NULL, verbose_
345345
args <- ""
346346
args <- paste(args, paste0("--input=", wbt_file_path(input)))
347347
if (!is.null(output)) {
348-
args <- paste(args, paste0("--output=", output))
348+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
349349
}
350350
if (!is.null(statement)) {
351351
args <- paste(args, paste0("--statement=", statement))
@@ -473,7 +473,7 @@ wbt_flightline_overlap <- function(input, output=NULL, resolution=1.0, wd=NULL,
473473
args <- ""
474474
args <- paste(args, paste0("--input=", wbt_file_path(input)))
475475
if (!is.null(output)) {
476-
args <- paste(args, paste0("--output=", output))
476+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
477477
}
478478
if (!is.null(resolution)) {
479479
args <- paste(args, paste0("--resolution=", resolution))
@@ -507,7 +507,7 @@ wbt_height_above_ground <- function(input, output=NULL, wd=NULL, verbose_mode=FA
507507
args <- ""
508508
args <- paste(args, paste0("--input=", wbt_file_path(input)))
509509
if (!is.null(output)) {
510-
args <- paste(args, paste0("--output=", output))
510+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
511511
}
512512
if (!missing(wd)) {
513513
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
@@ -565,7 +565,7 @@ wbt_las_to_laz <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, comp
565565
args <- ""
566566
args <- paste(args, paste0("--input=", wbt_file_path(input)))
567567
if (!is.null(output)) {
568-
args <- paste(args, paste0("--output=", output))
568+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
569569
}
570570
if (!missing(wd)) {
571571
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
@@ -691,7 +691,7 @@ wbt_laz_to_las <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, comp
691691
args <- ""
692692
args <- paste(args, paste0("--input=", wbt_file_path(input)))
693693
if (!is.null(output)) {
694-
args <- paste(args, paste0("--output=", output))
694+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
695695
}
696696
if (!missing(wd)) {
697697
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
@@ -723,7 +723,7 @@ wbt_lidar_block_maximum <- function(input, output=NULL, resolution=1.0, wd=NULL,
723723
args <- ""
724724
args <- paste(args, paste0("--input=", wbt_file_path(input)))
725725
if (!is.null(output)) {
726-
args <- paste(args, paste0("--output=", output))
726+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
727727
}
728728
if (!is.null(resolution)) {
729729
args <- paste(args, paste0("--resolution=", resolution))
@@ -758,7 +758,7 @@ wbt_lidar_block_minimum <- function(input, output=NULL, resolution=1.0, wd=NULL,
758758
args <- ""
759759
args <- paste(args, paste0("--input=", wbt_file_path(input)))
760760
if (!is.null(output)) {
761-
args <- paste(args, paste0("--output=", output))
761+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
762762
}
763763
if (!is.null(resolution)) {
764764
args <- paste(args, paste0("--resolution=", resolution))
@@ -868,7 +868,7 @@ wbt_lidar_contour <- function(input, output=NULL, interval=10.0, smooth=5, param
868868
args <- ""
869869
args <- paste(args, paste0("--input=", wbt_file_path(input)))
870870
if (!is.null(output)) {
871-
args <- paste(args, paste0("--output=", output))
871+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
872872
}
873873
if (!is.null(interval)) {
874874
args <- paste(args, paste0("--interval=", interval))
@@ -928,7 +928,7 @@ wbt_lidar_digital_surface_model <- function(input, output=NULL, resolution=1.0,
928928
args <- ""
929929
args <- paste(args, paste0("--input=", wbt_file_path(input)))
930930
if (!is.null(output)) {
931-
args <- paste(args, paste0("--output=", output))
931+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
932932
}
933933
if (!is.null(resolution)) {
934934
args <- paste(args, paste0("--resolution=", resolution))
@@ -1236,7 +1236,7 @@ wbt_lidar_idw_interpolation <- function(input, output=NULL, parameter="elevation
12361236
args <- ""
12371237
args <- paste(args, paste0("--input=", wbt_file_path(input)))
12381238
if (!is.null(output)) {
1239-
args <- paste(args, paste0("--output=", output))
1239+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
12401240
}
12411241
if (!is.null(parameter)) {
12421242
args <- paste(args, paste0("--parameter=", parameter))
@@ -1405,7 +1405,7 @@ wbt_lidar_nearest_neighbour_gridding <- function(input, output=NULL, parameter="
14051405
args <- ""
14061406
args <- paste(args, paste0("--input=", wbt_file_path(input)))
14071407
if (!is.null(output)) {
1408-
args <- paste(args, paste0("--output=", output))
1408+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
14091409
}
14101410
if (!is.null(parameter)) {
14111411
args <- paste(args, paste0("--parameter=", parameter))
@@ -1463,7 +1463,7 @@ wbt_lidar_point_density <- function(input, output=NULL, returns="all", resolutio
14631463
args <- ""
14641464
args <- paste(args, paste0("--input=", wbt_file_path(input)))
14651465
if (!is.null(output)) {
1466-
args <- paste(args, paste0("--output=", output))
1466+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
14671467
}
14681468
if (!is.null(returns)) {
14691469
args <- paste(args, paste0("--returns=", returns))
@@ -1512,7 +1512,7 @@ wbt_lidar_point_return_analysis <- function(input, output=NULL, wd=NULL, verbose
15121512
args <- ""
15131513
args <- paste(args, paste0("--input=", wbt_file_path(input)))
15141514
if (!is.null(output)) {
1515-
args <- paste(args, paste0("--output=", output))
1515+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
15161516
}
15171517
if (!missing(wd)) {
15181518
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
@@ -1669,7 +1669,7 @@ wbt_lidar_rbf_interpolation <- function(input, output=NULL, parameter="elevation
16691669
args <- ""
16701670
args <- paste(args, paste0("--input=", wbt_file_path(input)))
16711671
if (!is.null(output)) {
1672-
args <- paste(args, paste0("--output=", output))
1672+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
16731673
}
16741674
if (!is.null(parameter)) {
16751675
args <- paste(args, paste0("--parameter=", parameter))
@@ -2038,7 +2038,7 @@ wbt_lidar_sibson_interpolation <- function(input, output=NULL, parameter="elevat
20382038
args <- ""
20392039
args <- paste(args, paste0("--input=", wbt_file_path(input)))
20402040
if (!is.null(output)) {
2041-
args <- paste(args, paste0("--output=", output))
2041+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
20422042
}
20432043
if (!is.null(parameter)) {
20442044
args <- paste(args, paste0("--parameter=", parameter))
@@ -2283,7 +2283,7 @@ wbt_lidar_tin_gridding <- function(input, output=NULL, parameter="elevation", re
22832283
args <- ""
22842284
args <- paste(args, paste0("--input=", wbt_file_path(input)))
22852285
if (!is.null(output)) {
2286-
args <- paste(args, paste0("--output=", output))
2286+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
22872287
}
22882288
if (!is.null(parameter)) {
22892289
args <- paste(args, paste0("--parameter=", parameter))
@@ -2369,7 +2369,7 @@ wbt_modify_lidar <- function(input, output=NULL, statement="", wd=NULL, verbose_
23692369
args <- ""
23702370
args <- paste(args, paste0("--input=", wbt_file_path(input)))
23712371
if (!is.null(output)) {
2372-
args <- paste(args, paste0("--output=", output))
2372+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
23732373
}
23742374
if (!is.null(statement)) {
23752375
args <- paste(args, paste0("--statement=", statement))
@@ -2513,7 +2513,7 @@ wbt_sort_lidar <- function(input, output=NULL, criteria="", wd=NULL, verbose_mod
25132513
args <- ""
25142514
args <- paste(args, paste0("--input=", wbt_file_path(input)))
25152515
if (!is.null(output)) {
2516-
args <- paste(args, paste0("--output=", output))
2516+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
25172517
}
25182518
if (!is.null(criteria)) {
25192519
args <- paste(args, paste0("--criteria=", criteria))

PY2R/scripts/machine_learning.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ wbt_knn_classification <- function(inputs, training, field, scaling="Normalize",
119119
args <- paste(args, paste0("--scaling=", scaling))
120120
}
121121
if (!is.null(output)) {
122-
args <- paste(args, paste0("--output=", output))
122+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
123123
}
124124
if (!is.null(k)) {
125125
args <- paste(args, paste0("--k=", k))
@@ -170,7 +170,7 @@ wbt_knn_regression <- function(inputs, training, field, scaling="Normalize", out
170170
args <- paste(args, paste0("--scaling=", scaling))
171171
}
172172
if (!is.null(output)) {
173-
args <- paste(args, paste0("--output=", output))
173+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
174174
}
175175
if (!is.null(k)) {
176176
args <- paste(args, paste0("--k=", k))
@@ -219,7 +219,7 @@ wbt_logistic_regression <- function(inputs, training, field, scaling="Normalize"
219219
args <- paste(args, paste0("--scaling=", scaling))
220220
}
221221
if (!is.null(output)) {
222-
args <- paste(args, paste0("--output=", output))
222+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
223223
}
224224
if (!is.null(test_proportion)) {
225225
args <- paste(args, paste0("--test_proportion=", test_proportion))
@@ -311,7 +311,7 @@ wbt_random_forest_classification <- function(inputs, training, field, output=NUL
311311
args <- paste(args, paste0("--training=", wbt_file_path(training)))
312312
args <- paste(args, paste0("--field=", wbt_file_path(field)))
313313
if (!is.null(output)) {
314-
args <- paste(args, paste0("--output=", output))
314+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
315315
}
316316
if (!is.null(split_criterion)) {
317317
args <- paste(args, paste0("--split_criterion=", split_criterion))
@@ -365,7 +365,7 @@ wbt_random_forest_regression <- function(inputs, training, field, output=NULL, n
365365
args <- paste(args, paste0("--training=", wbt_file_path(training)))
366366
args <- paste(args, paste0("--field=", wbt_file_path(field)))
367367
if (!is.null(output)) {
368-
args <- paste(args, paste0("--output=", output))
368+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
369369
}
370370
if (!is.null(n_trees)) {
371371
args <- paste(args, paste0("--n_trees=", n_trees))
@@ -420,7 +420,7 @@ wbt_svm_classification <- function(inputs, training, field, scaling="Normalize",
420420
args <- paste(args, paste0("--scaling=", scaling))
421421
}
422422
if (!is.null(output)) {
423-
args <- paste(args, paste0("--output=", output))
423+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
424424
}
425425
if (!is.null(c)) {
426426
args <- paste(args, paste0("--c=", c))
@@ -475,7 +475,7 @@ wbt_svm_regression <- function(inputs, training, field, scaling="Normalize", out
475475
args <- paste(args, paste0("--scaling=", scaling))
476476
}
477477
if (!is.null(output)) {
478-
args <- paste(args, paste0("--output=", output))
478+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
479479
}
480480
if (!is.null(c)) {
481481
args <- paste(args, paste0("--c=", c))

PY2R/scripts/math_stat_analysis.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ wbt_attribute_correlation <- function(input, output=NULL, wd=NULL, verbose_mode=
405405
args <- ""
406406
args <- paste(args, paste0("--input=", wbt_file_path(input)))
407407
if (!is.null(output)) {
408-
args <- paste(args, paste0("--output=", output))
408+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
409409
}
410410
if (!missing(wd)) {
411411
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
@@ -740,7 +740,7 @@ wbt_crispness_index <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE,
740740
args <- ""
741741
args <- paste(args, paste0("--input=", wbt_file_path(input)))
742742
if (!is.null(output)) {
743-
args <- paste(args, paste0("--output=", output))
743+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
744744
}
745745
if (!missing(wd)) {
746746
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
@@ -1077,7 +1077,7 @@ wbt_image_correlation <- function(inputs, output=NULL, wd=NULL, verbose_mode=FAL
10771077
args <- ""
10781078
args <- paste(args, paste0("--inputs=", wbt_file_path(inputs)))
10791079
if (!is.null(output)) {
1080-
args <- paste(args, paste0("--output=", output))
1080+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
10811081
}
10821082
if (!missing(wd)) {
10831083
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))
@@ -2810,7 +2810,7 @@ wbt_zonal_statistics <- function(input, features, output=NULL, stat="mean", out_
28102810
args <- paste(args, paste0("--input=", wbt_file_path(input)))
28112811
args <- paste(args, paste0("--features=", wbt_file_path(features)))
28122812
if (!is.null(output)) {
2813-
args <- paste(args, paste0("--output=", output))
2813+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
28142814
}
28152815
if (!is.null(stat)) {
28162816
args <- paste(args, paste0("--stat=", stat))

R/gis_analysis.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ wbt_raster_area <- function(input, output=NULL, out_text=FALSE, units="grid cell
12011201
args <- ""
12021202
args <- paste(args, paste0("--input=", wbt_file_path(input)))
12031203
if (!is.null(output)) {
1204-
args <- paste(args, paste0("--output=", output))
1204+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
12051205
}
12061206
if (out_text) {
12071207
args <- paste(args, "--out_text")
@@ -1277,7 +1277,7 @@ wbt_raster_perimeter <- function(input, output=NULL, out_text=FALSE, units="grid
12771277
args <- ""
12781278
args <- paste(args, paste0("--input=", wbt_file_path(input)))
12791279
if (!is.null(output)) {
1280-
args <- paste(args, paste0("--output=", output))
1280+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
12811281
}
12821282
if (out_text) {
12831283
args <- paste(args, "--out_text")

R/hydro_analysis.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,10 @@ wbt_depth_to_water <- function(dem, output, streams=NULL, lakes=NULL, wd=NULL, v
531531
args <- paste(args, paste0("--dem=", wbt_file_path(dem)))
532532
args <- paste(args, paste0("--output=", wbt_file_path(output)))
533533
if (!is.null(streams)) {
534-
args <- paste(args, paste0("--streams=", streams))
534+
args <- paste(args, paste0("--streams=", wbt_file_path(streams)))
535535
}
536536
if (!is.null(lakes)) {
537-
args <- paste(args, paste0("--lakes=", lakes))
537+
args <- paste(args, paste0("--lakes=", wbt_file_path(lakes)))
538538
}
539539
if (!missing(wd)) {
540540
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))

R/image_analysis.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ wbt_ihs_to_rgb <- function(intensity, hue, saturation, red=NULL, green=NULL, blu
180180
args <- paste(args, paste0("--blue=", blue))
181181
}
182182
if (!is.null(output)) {
183-
args <- paste(args, paste0("--output=", output))
183+
args <- paste(args, paste0("--output=", wbt_file_path(output)))
184184
}
185185
if (!missing(wd)) {
186186
args <- paste(args, paste0("--wd=", wbt_file_path(wd)))

0 commit comments

Comments
 (0)