diff --git a/NEWS.md b/NEWS.md index 74a86ac7f..e7da946e7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# whitebox 2.1.3 + + * Updates to fix issues with permissions to write _settings.jso*n_ + + * Generated `whitebox_tools` commands no longer include flags for default arguments + # whitebox 2.1.2 * Fixes regression in checking "Demo" vignette on CRAN diff --git a/PY2R/automation.py b/PY2R/automation.py index 3d75c7ed4..da4990d0d 100644 --- a/PY2R/automation.py +++ b/PY2R/automation.py @@ -88,7 +88,18 @@ def function_block(line, ff): ff.write(" }" + "\n") elif "verbose" not in item: para = item.split("=")[0] - if '"' not in para: + if '"' not in para and "wd" in para or "compress_rasters" in para: + ff.write(" if (!missing(" + para + ")) {" + "\n") + ff.write( + ' args <- paste(args, paste0("--' + + para + + '=", ' + + para + + "))" + + "\n" + ) + ff.write(" }" + "\n") + elif '"' not in para: ff.write(" if (!is.null(" + para + ")) {" + "\n") ff.write( ' args <- paste(args, paste0("--' diff --git a/PY2R/scripts/data_tools.R b/PY2R/scripts/data_tools.R index 5e4658fe1..5c6465fec 100644 --- a/PY2R/scripts/data_tools.R +++ b/PY2R/scripts/data_tools.R @@ -14,10 +14,10 @@ wbt_add_point_coordinates_to_table <- function(input, wd=NULL, verbose_mode=FALS wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "add_point_coordinates_to_table" @@ -43,10 +43,10 @@ wbt_clean_vector <- function(input, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clean_vector" @@ -72,10 +72,10 @@ wbt_convert_nodata_to_zero <- function(input, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "convert_nodata_to_zero" @@ -101,10 +101,10 @@ wbt_convert_raster_format <- function(input, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "convert_raster_format" @@ -142,10 +142,10 @@ wbt_csv_points_to_vector <- function(input, output, xfield=0, yfield=1, epsg=NUL if (!is.null(epsg)) { args <- paste(args, paste0("--epsg=", epsg)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "csv_points_to_vector" @@ -175,10 +175,10 @@ wbt_export_table_to_csv <- function(input, output, headers=TRUE, wd=NULL, verbos if (headers) { args <- paste(args, "--headers") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "export_table_to_csv" @@ -208,10 +208,10 @@ wbt_fix_dangling_arcs <- function(input, output, dist="", wd=NULL, verbose_mode= if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fix_dangling_arcs" @@ -243,10 +243,10 @@ wbt_join_tables <- function(input1, pkey, input2, fkey, import_field, wd=NULL, v args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--fkey=", wbt_file_path(fkey))) args <- paste(args, paste0("--import_field=", wbt_file_path(import_field))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "join_tables" @@ -272,10 +272,10 @@ wbt_lines_to_polygons <- function(input, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lines_to_polygons" @@ -309,10 +309,10 @@ wbt_merge_table_with_csv <- function(input, pkey, csv, fkey, import_field=NULL, if (!is.null(import_field)) { args <- paste(args, paste0("--import_field=", import_field)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "merge_table_with_csv" @@ -338,10 +338,10 @@ wbt_merge_vectors <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compr args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "merge_vectors" @@ -369,10 +369,10 @@ wbt_modify_no_data_value <- function(input, new_value="-32768.0", wd=NULL, verbo if (!is.null(new_value)) { args <- paste(args, paste0("--new_value=", new_value)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "modify_no_data_value" @@ -402,10 +402,10 @@ wbt_multi_part_to_single_part <- function(input, output, exclude_holes=TRUE, wd= if (exclude_holes) { args <- paste(args, "--exclude_holes") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multi_part_to_single_part" @@ -443,10 +443,10 @@ wbt_new_raster_from_base <- function(base, output, value="nodata", data_type="fl if (!is.null(cell_size)) { args <- paste(args, paste0("--cell_size=", cell_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "new_raster_from_base" @@ -472,10 +472,10 @@ wbt_polygons_to_lines <- function(input, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygons_to_lines" @@ -499,10 +499,10 @@ wbt_print_geo_tiff_tags <- function(input, wd=NULL, verbose_mode=FALSE, compress wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "print_geo_tiff_tags" @@ -528,10 +528,10 @@ wbt_raster_to_vector_lines <- function(input, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_to_vector_lines" @@ -557,10 +557,10 @@ wbt_raster_to_vector_points <- function(input, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_to_vector_points" @@ -586,10 +586,10 @@ wbt_raster_to_vector_polygons <- function(input, output, wd=NULL, verbose_mode=F args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_to_vector_polygons" @@ -613,10 +613,10 @@ wbt_reinitialize_attribute_table <- function(input, wd=NULL, verbose_mode=FALSE, wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reinitialize_attribute_table" @@ -642,10 +642,10 @@ wbt_remove_polygon_holes <- function(input, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_polygon_holes" @@ -675,10 +675,10 @@ wbt_set_nodata_value <- function(input, output, back_value=0.0, wd=NULL, verbose if (!is.null(back_value)) { args <- paste(args, paste0("--back_value=", back_value)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "set_nodata_value" @@ -708,10 +708,10 @@ wbt_single_part_to_multi_part <- function(input, output, field=NULL, wd=NULL, ve if (!is.null(field)) { args <- paste(args, paste0("--field=", field)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "single_part_to_multi_part" @@ -753,10 +753,10 @@ wbt_vector_lines_to_raster <- function(input, output, field="FID", nodata=TRUE, if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_lines_to_raster" @@ -802,10 +802,10 @@ wbt_vector_points_to_raster <- function(input, output, field="FID", assign="last if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_points_to_raster" @@ -847,10 +847,10 @@ wbt_vector_polygons_to_raster <- function(input, output, field="FID", nodata=TRU if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_polygons_to_raster" diff --git a/PY2R/scripts/gis_analysis.R b/PY2R/scripts/gis_analysis.R index e31f6cb77..e44288e2d 100644 --- a/PY2R/scripts/gis_analysis.R +++ b/PY2R/scripts/gis_analysis.R @@ -24,10 +24,10 @@ wbt_aggregate_raster <- function(input, output, agg_factor=2, type="mean", wd=NU if (!is.null(type)) { args <- paste(args, paste0("--type=", type)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "aggregate_raster" @@ -67,10 +67,10 @@ wbt_block_maximum_gridding <- function(input, field, output, use_z=FALSE, cell_s if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "block_maximum_gridding" @@ -110,10 +110,10 @@ wbt_block_minimum_gridding <- function(input, field, output, use_z=FALSE, cell_s if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "block_minimum_gridding" @@ -143,10 +143,10 @@ wbt_centroid <- function(input, output, text_output=FALSE, wd=NULL, verbose_mode if (text_output) { args <- paste(args, "--text_output") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "centroid" @@ -172,10 +172,10 @@ wbt_centroid_vector <- function(input, output, wd=NULL, verbose_mode=FALSE, comp args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "centroid_vector" @@ -209,10 +209,10 @@ wbt_clump <- function(input, output, diag=TRUE, zero_back=FALSE, wd=NULL, verbos if (zero_back) { args <- paste(args, "--zero_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clump" @@ -250,10 +250,10 @@ wbt_construct_vector_tin <- function(input, output, field=NULL, use_z=FALSE, max if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "construct_vector_tin" @@ -285,10 +285,10 @@ wbt_create_hexagonal_vector_grid <- function(input, output, width, orientation=" if (!is.null(orientation)) { args <- paste(args, paste0("--orientation=", orientation)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_hexagonal_vector_grid" @@ -326,10 +326,10 @@ wbt_create_plane <- function(base, output, gradient=15.0, aspect=90.0, constant= if (!is.null(constant)) { args <- paste(args, paste0("--constant=", constant)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_plane" @@ -367,10 +367,10 @@ wbt_create_rectangular_vector_grid <- function(input, output, width, height, xor if (!is.null(yorig)) { args <- paste(args, paste0("--yorig=", yorig)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_rectangular_vector_grid" @@ -404,10 +404,10 @@ wbt_dissolve <- function(input, output, field=NULL, snap=0.0, wd=NULL, verbose_m if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "dissolve" @@ -435,10 +435,10 @@ wbt_eliminate_coincident_points <- function(input, output, tolerance, wd=NULL, v args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--tolerance=", wbt_file_path(tolerance))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "eliminate_coincident_points" @@ -470,10 +470,10 @@ wbt_extend_vector_lines <- function(input, output, dist, extend="both ends", wd= if (!is.null(extend)) { args <- paste(args, paste0("--extend=", extend)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extend_vector_lines" @@ -499,10 +499,10 @@ wbt_extract_nodes <- function(input, output, wd=NULL, verbose_mode=FALSE, compre args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_nodes" @@ -532,10 +532,10 @@ wbt_extract_raster_values_at_points <- function(inputs, points, out_text=FALSE, if (out_text) { args <- paste(args, "--out_text") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_raster_values_at_points" @@ -567,10 +567,10 @@ wbt_filter_raster_features_by_area <- function(input, output, threshold, backgro if (!is.null(background)) { args <- paste(args, paste0("--background=", background)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "filter_raster_features_by_area" @@ -600,10 +600,10 @@ wbt_find_lowest_or_highest_points <- function(input, output, out_type="lowest", if (!is.null(out_type)) { args <- paste(args, paste0("--out_type=", out_type)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_lowest_or_highest_points" @@ -655,10 +655,10 @@ wbt_idw_interpolation <- function(input, field, output, use_z=FALSE, weight=2.0, if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "idw_interpolation" @@ -684,10 +684,10 @@ wbt_layer_footprint <- function(input, output, wd=NULL, verbose_mode=FALSE, comp args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "layer_footprint" @@ -713,10 +713,10 @@ wbt_medoid <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "medoid" @@ -750,10 +750,10 @@ wbt_minimum_bounding_box <- function(input, output, criterion="area", features=T if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_bounding_box" @@ -783,10 +783,10 @@ wbt_minimum_bounding_circle <- function(input, output, features=TRUE, wd=NULL, v if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_bounding_circle" @@ -816,10 +816,10 @@ wbt_minimum_bounding_envelope <- function(input, output, features=TRUE, wd=NULL, if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_bounding_envelope" @@ -849,10 +849,10 @@ wbt_minimum_convex_hull <- function(input, output, features=TRUE, wd=NULL, verbo if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_convex_hull" @@ -898,10 +898,10 @@ wbt_natural_neighbour_interpolation <- function(input, output, field=NULL, use_z if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "natural_neighbour_interpolation" @@ -945,10 +945,10 @@ wbt_nearest_neighbour_gridding <- function(input, field, output, use_z=FALSE, ce if (!is.null(max_dist)) { args <- paste(args, paste0("--max_dist=", max_dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "nearest_neighbour_gridding" @@ -972,10 +972,10 @@ wbt_polygon_area <- function(input, wd=NULL, verbose_mode=FALSE, compress_raster wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_area" @@ -1001,10 +1001,10 @@ wbt_polygon_long_axis <- function(input, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_long_axis" @@ -1028,10 +1028,10 @@ wbt_polygon_perimeter <- function(input, wd=NULL, verbose_mode=FALSE, compress_r wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_perimeter" @@ -1057,10 +1057,10 @@ wbt_polygon_short_axis <- function(input, output, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_short_axis" @@ -1120,10 +1120,10 @@ wbt_radial_basis_function_interpolation <- function(input, field, output, use_z= if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "radial_basis_function_interpolation" @@ -1163,10 +1163,10 @@ wbt_raster_area <- function(input, output=NULL, out_text=FALSE, units="grid cell if (zero_back) { args <- paste(args, "--zero_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_area" @@ -1196,10 +1196,10 @@ wbt_raster_cell_assignment <- function(input, output, assign="column", wd=NULL, if (!is.null(assign)) { args <- paste(args, paste0("--assign=", assign)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_cell_assignment" @@ -1239,10 +1239,10 @@ wbt_raster_perimeter <- function(input, output=NULL, out_text=FALSE, units="grid if (zero_back) { args <- paste(args, "--zero_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_perimeter" @@ -1274,10 +1274,10 @@ wbt_reclass <- function(input, output, reclass_vals, assign_mode=FALSE, wd=NULL, if (assign_mode) { args <- paste(args, "--assign_mode") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reclass" @@ -1315,10 +1315,10 @@ wbt_reclass_equal_interval <- function(input, output, interval=10.0, start_val=N if (!is.null(end_val)) { args <- paste(args, paste0("--end_val=", end_val)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reclass_equal_interval" @@ -1346,10 +1346,10 @@ wbt_reclass_from_file <- function(input, reclass_file, output, wd=NULL, verbose_ args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--reclass_file=", wbt_file_path(reclass_file))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reclass_from_file" @@ -1379,10 +1379,10 @@ wbt_smooth_vectors <- function(input, output, filter=3, wd=NULL, verbose_mode=FA if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "smooth_vectors" @@ -1412,10 +1412,10 @@ wbt_split_vector_lines <- function(input, output, length=NULL, wd=NULL, verbose_ if (!is.null(length)) { args <- paste(args, paste0("--length=", length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "split_vector_lines" @@ -1461,10 +1461,10 @@ wbt_tin_gridding <- function(input, output, field=NULL, use_z=FALSE, resolution= if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tin_gridding" @@ -1496,10 +1496,10 @@ wbt_vector_hex_binning <- function(input, output, width, orientation="horizontal if (!is.null(orientation)) { args <- paste(args, paste0("--orientation=", orientation)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_hex_binning" @@ -1525,10 +1525,10 @@ wbt_voronoi_diagram <- function(input, output, wd=NULL, verbose_mode=FALSE, comp args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "voronoi_diagram" @@ -1560,10 +1560,10 @@ wbt_buffer_raster <- function(input, output, size, gridcells=FALSE, wd=NULL, ver if (gridcells) { args <- paste(args, "--gridcells") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "buffer_raster" @@ -1591,10 +1591,10 @@ wbt_cost_allocation <- function(source, backlink, output, wd=NULL, verbose_mode= args <- paste(args, paste0("--source=", wbt_file_path(source))) args <- paste(args, paste0("--backlink=", wbt_file_path(backlink))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cost_allocation" @@ -1624,10 +1624,10 @@ wbt_cost_distance <- function(source, cost, out_accum, out_backlink, wd=NULL, ve args <- paste(args, paste0("--cost=", wbt_file_path(cost))) args <- paste(args, paste0("--out_accum=", wbt_file_path(out_accum))) args <- paste(args, paste0("--out_backlink=", wbt_file_path(out_backlink))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cost_distance" @@ -1659,10 +1659,10 @@ wbt_cost_pathway <- function(destination, backlink, output, zero_background=FALS if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cost_pathway" @@ -1688,10 +1688,10 @@ wbt_euclidean_allocation <- function(input, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "euclidean_allocation" @@ -1717,10 +1717,10 @@ wbt_euclidean_distance <- function(input, output, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "euclidean_distance" @@ -1746,10 +1746,10 @@ wbt_average_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_overlay" @@ -1777,10 +1777,10 @@ wbt_clip <- function(input, clip, output, wd=NULL, verbose_mode=FALSE, compress_ args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--clip=", wbt_file_path(clip))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clip" @@ -1812,10 +1812,10 @@ wbt_clip_raster_to_polygon <- function(input, polygons, output, maintain_dimensi if (maintain_dimensions) { args <- paste(args, "--maintain_dimensions") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clip_raster_to_polygon" @@ -1843,10 +1843,10 @@ wbt_count_if <- function(inputs, output, value, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--value=", wbt_file_path(value))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "count_if" @@ -1874,10 +1874,10 @@ wbt_difference <- function(input, overlay, output, wd=NULL, verbose_mode=FALSE, args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--overlay=", wbt_file_path(overlay))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "difference" @@ -1905,10 +1905,10 @@ wbt_erase <- function(input, erase, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--erase=", wbt_file_path(erase))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "erase" @@ -1936,10 +1936,10 @@ wbt_erase_polygon_from_raster <- function(input, polygons, output, wd=NULL, verb args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "erase_polygon_from_raster" @@ -1965,10 +1965,10 @@ wbt_highest_position <- function(inputs, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "highest_position" @@ -2000,10 +2000,10 @@ wbt_intersect <- function(input, overlay, output, snap=0.0, wd=NULL, verbose_mod if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "intersect" @@ -2031,10 +2031,10 @@ wbt_line_intersections <- function(input1, input2, output, wd=NULL, verbose_mode args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "line_intersections" @@ -2060,10 +2060,10 @@ wbt_lowest_position <- function(inputs, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lowest_position" @@ -2089,10 +2089,10 @@ wbt_max_absolute_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_absolute_overlay" @@ -2118,10 +2118,10 @@ wbt_max_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_overlay" @@ -2151,10 +2151,10 @@ wbt_merge_line_segments <- function(input, output, snap=0.0, wd=NULL, verbose_mo if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "merge_line_segments" @@ -2180,10 +2180,10 @@ wbt_min_absolute_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_absolute_overlay" @@ -2209,10 +2209,10 @@ wbt_min_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_overlay" @@ -2240,10 +2240,10 @@ wbt_percent_equal_to <- function(inputs, comparison, output, wd=NULL, verbose_mo args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--comparison=", wbt_file_path(comparison))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_equal_to" @@ -2271,10 +2271,10 @@ wbt_percent_greater_than <- function(inputs, comparison, output, wd=NULL, verbos args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--comparison=", wbt_file_path(comparison))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_greater_than" @@ -2302,10 +2302,10 @@ wbt_percent_less_than <- function(inputs, comparison, output, wd=NULL, verbose_m args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--comparison=", wbt_file_path(comparison))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_less_than" @@ -2333,10 +2333,10 @@ wbt_pick_from_list <- function(inputs, pos_input, output, wd=NULL, verbose_mode= args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--pos_input=", wbt_file_path(pos_input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "pick_from_list" @@ -2362,10 +2362,10 @@ wbt_polygonize <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygonize" @@ -2393,10 +2393,10 @@ wbt_split_with_lines <- function(input, split, output, wd=NULL, verbose_mode=FAL args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--split=", wbt_file_path(split))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "split_with_lines" @@ -2422,10 +2422,10 @@ wbt_sum_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sum_overlay" @@ -2457,10 +2457,10 @@ wbt_symmetrical_difference <- function(input, overlay, output, snap=0.0, wd=NULL if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "symmetrical_difference" @@ -2492,10 +2492,10 @@ wbt_union <- function(input, overlay, output, snap=0.0, wd=NULL, verbose_mode=FA if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "union" @@ -2523,10 +2523,10 @@ wbt_update_nodata_cells <- function(input1, input2, output, wd=NULL, verbose_mod args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "update_nodata_cells" @@ -2566,10 +2566,10 @@ wbt_weighted_overlay <- function(factors, weights, output, cost=NULL, constraint if (!is.null(scale_max)) { args <- paste(args, paste0("--scale_max=", scale_max)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "weighted_overlay" @@ -2597,10 +2597,10 @@ wbt_weighted_sum <- function(inputs, weights, output, wd=NULL, verbose_mode=FALS args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--weights=", wbt_file_path(weights))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "weighted_sum" @@ -2626,10 +2626,10 @@ wbt_boundary_shape_complexity <- function(input, output, wd=NULL, verbose_mode=F args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "boundary_shape_complexity" @@ -2653,10 +2653,10 @@ wbt_compactness_ratio <- function(input, wd=NULL, verbose_mode=FALSE, compress_r wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "compactness_ratio" @@ -2686,10 +2686,10 @@ wbt_edge_proportion <- function(input, output, output_text=FALSE, wd=NULL, verbo if (output_text) { args <- paste(args, "--output_text") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_proportion" @@ -2713,10 +2713,10 @@ wbt_elongation_ratio <- function(input, wd=NULL, verbose_mode=FALSE, compress_ra wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elongation_ratio" @@ -2742,10 +2742,10 @@ wbt_find_patch_or_class_edge_cells <- function(input, output, wd=NULL, verbose_m args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_patch_or_class_edge_cells" @@ -2769,10 +2769,10 @@ wbt_hole_proportion <- function(input, wd=NULL, verbose_mode=FALSE, compress_ras wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hole_proportion" @@ -2796,10 +2796,10 @@ wbt_linearity_index <- function(input, wd=NULL, verbose_mode=FALSE, compress_ras wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "linearity_index" @@ -2825,10 +2825,10 @@ wbt_narrowness_index <- function(input, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "narrowness_index" @@ -2852,10 +2852,10 @@ wbt_patch_orientation <- function(input, wd=NULL, verbose_mode=FALSE, compress_r wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "patch_orientation" @@ -2879,10 +2879,10 @@ wbt_perimeter_area_ratio <- function(input, wd=NULL, verbose_mode=FALSE, compres wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "perimeter_area_ratio" @@ -2912,10 +2912,10 @@ wbt_radius_of_gyration <- function(input, output, text_output=FALSE, wd=NULL, ve if (text_output) { args <- paste(args, "--text_output") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "radius_of_gyration" @@ -2939,10 +2939,10 @@ wbt_related_circumscribing_circle <- function(input, wd=NULL, verbose_mode=FALSE wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "related_circumscribing_circle" @@ -2966,10 +2966,10 @@ wbt_shape_complexity_index <- function(input, wd=NULL, verbose_mode=FALSE, compr wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shape_complexity_index" @@ -2995,10 +2995,10 @@ wbt_shape_complexity_index_raster <- function(input, output, wd=NULL, verbose_mo args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shape_complexity_index_raster" diff --git a/PY2R/scripts/hydro_analysis.R b/PY2R/scripts/hydro_analysis.R index bef8430f3..6fb7d95d1 100644 --- a/PY2R/scripts/hydro_analysis.R +++ b/PY2R/scripts/hydro_analysis.R @@ -16,10 +16,10 @@ wbt_average_flowpath_slope <- function(dem, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_flowpath_slope" @@ -45,10 +45,10 @@ wbt_average_upslope_flowpath_length <- function(dem, output, wd=NULL, verbose_mo args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_upslope_flowpath_length" @@ -78,10 +78,10 @@ wbt_basins <- function(d8_pntr, output, esri_pntr=FALSE, wd=NULL, verbose_mode=F if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "basins" @@ -123,10 +123,10 @@ wbt_breach_depressions <- function(dem, output, max_depth=NULL, max_length=NULL, if (fill_pits) { args <- paste(args, "--fill_pits") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "breach_depressions" @@ -170,10 +170,10 @@ wbt_breach_depressions_least_cost <- function(dem, output, dist, max_cost=NULL, if (fill) { args <- paste(args, "--fill") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "breach_depressions_least_cost" @@ -199,10 +199,10 @@ wbt_breach_single_cell_pits <- function(dem, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "breach_single_cell_pits" @@ -236,10 +236,10 @@ wbt_burn_streams_at_roads <- function(dem, streams, roads, output, width=NULL, w if (!is.null(width)) { args <- paste(args, paste0("--width=", width)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "burn_streams_at_roads" @@ -285,10 +285,10 @@ wbt_d8_flow_accumulation <- function(input, output, out_type="cells", log=FALSE, if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d8_flow_accumulation" @@ -320,10 +320,10 @@ wbt_d8_mass_flux <- function(dem, loading, efficiency, absorption, output, wd=NU args <- paste(args, paste0("--efficiency=", wbt_file_path(efficiency))) args <- paste(args, paste0("--absorption=", wbt_file_path(absorption))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d8_mass_flux" @@ -353,10 +353,10 @@ wbt_d8_pointer <- function(dem, output, esri_pntr=FALSE, wd=NULL, verbose_mode=F if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d8_pointer" @@ -402,10 +402,10 @@ wbt_d_inf_flow_accumulation <- function(input, output, out_type="Specific Contri if (pntr) { args <- paste(args, "--pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d_inf_flow_accumulation" @@ -437,10 +437,10 @@ wbt_d_inf_mass_flux <- function(dem, loading, efficiency, absorption, output, wd args <- paste(args, paste0("--efficiency=", wbt_file_path(efficiency))) args <- paste(args, paste0("--absorption=", wbt_file_path(absorption))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d_inf_mass_flux" @@ -466,10 +466,10 @@ wbt_d_inf_pointer <- function(dem, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d_inf_pointer" @@ -499,10 +499,10 @@ wbt_depth_in_sink <- function(dem, output, zero_background=FALSE, wd=NULL, verbo if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "depth_in_sink" @@ -534,10 +534,10 @@ wbt_downslope_distance_to_stream <- function(dem, streams, output, dinf=FALSE, w if (dinf) { args <- paste(args, "--dinf") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "downslope_distance_to_stream" @@ -575,10 +575,10 @@ wbt_downslope_flowpath_length <- function(d8_pntr, output, watersheds=NULL, weig if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "downslope_flowpath_length" @@ -612,10 +612,10 @@ wbt_edge_contamination <- function(dem, output, flow_type="mfd", zfactor="", wd= if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_contamination" @@ -643,10 +643,10 @@ wbt_elevation_above_stream <- function(dem, streams, output, wd=NULL, verbose_mo args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elevation_above_stream" @@ -674,10 +674,10 @@ wbt_elevation_above_stream_euclidean <- function(dem, streams, output, wd=NULL, args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elevation_above_stream_euclidean" @@ -723,10 +723,10 @@ wbt_fd8_flow_accumulation <- function(dem, output, out_type="specific contributi if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fd8_flow_accumulation" @@ -752,10 +752,10 @@ wbt_fd8_pointer <- function(dem, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fd8_pointer" @@ -783,10 +783,10 @@ wbt_fill_burn <- function(dem, streams, output, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_burn" @@ -824,10 +824,10 @@ wbt_fill_depressions <- function(dem, output, fix_flats=TRUE, flat_increment=NUL if (!is.null(max_depth)) { args <- paste(args, paste0("--max_depth=", max_depth)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_depressions" @@ -861,10 +861,10 @@ wbt_fill_depressions_planchon_and_darboux <- function(dem, output, fix_flats=TRU if (!is.null(flat_increment)) { args <- paste(args, paste0("--flat_increment=", flat_increment)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_depressions_planchon_and_darboux" @@ -898,10 +898,10 @@ wbt_fill_depressions_wang_and_liu <- function(dem, output, fix_flats=TRUE, flat_ if (!is.null(flat_increment)) { args <- paste(args, paste0("--flat_increment=", flat_increment)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_depressions_wang_and_liu" @@ -927,10 +927,10 @@ wbt_fill_single_cell_pits <- function(dem, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_single_cell_pits" @@ -956,10 +956,10 @@ wbt_find_no_flow_cells <- function(dem, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_no_flow_cells" @@ -987,10 +987,10 @@ wbt_find_parallel_flow <- function(d8_pntr, streams, output, wd=NULL, verbose_mo args <- paste(args, paste0("--d8_pntr=", wbt_file_path(d8_pntr))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_parallel_flow" @@ -1018,10 +1018,10 @@ wbt_flatten_lakes <- function(dem, lakes, output, wd=NULL, verbose_mode=FALSE, c args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--lakes=", wbt_file_path(lakes))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flatten_lakes" @@ -1047,10 +1047,10 @@ wbt_flood_order <- function(dem, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flood_order" @@ -1096,10 +1096,10 @@ wbt_flow_accumulation_full_workflow <- function(dem, out_dem, out_pntr, out_accu if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flow_accumulation_full_workflow" @@ -1129,10 +1129,10 @@ wbt_flow_length_diff <- function(d8_pntr, output, esri_pntr=FALSE, wd=NULL, verb if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flow_length_diff" @@ -1164,10 +1164,10 @@ wbt_hillslopes <- function(d8_pntr, streams, output, esri_pntr=FALSE, wd=NULL, v if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hillslopes" @@ -1203,10 +1203,10 @@ wbt_hydrologic_connectivity <- function(dem, output1, output2, exponent=1.0, thr if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hydrologic_connectivity" @@ -1252,10 +1252,10 @@ wbt_impoundment_size_index <- function(dem, damlength, out_mean=NULL, out_max=NU if (!is.null(out_dam_height)) { args <- paste(args, paste0("--out_dam_height=", out_dam_height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "impoundment_size_index" @@ -1285,10 +1285,10 @@ wbt_insert_dams <- function(dem, dam_pts, output, damlength, wd=NULL, verbose_mo args <- paste(args, paste0("--dam_pts=", wbt_file_path(dam_pts))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--damlength=", wbt_file_path(damlength))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "insert_dams" @@ -1320,10 +1320,10 @@ wbt_isobasins <- function(dem, output, size, connections=FALSE, wd=NULL, verbose if (connections) { args <- paste(args, "--connections") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "isobasins" @@ -1353,10 +1353,10 @@ wbt_jenson_snap_pour_points <- function(pour_pts, streams, output, snap_dist, wd args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--snap_dist=", wbt_file_path(snap_dist))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "jenson_snap_pour_points" @@ -1384,10 +1384,10 @@ wbt_longest_flowpath <- function(dem, basins, output, wd=NULL, verbose_mode=FALS args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--basins=", wbt_file_path(basins))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "longest_flowpath" @@ -1415,10 +1415,10 @@ wbt_low_points_on_headwater_divides <- function(dem, streams, output, wd=NULL, v args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "low_points_on_headwater_divides" @@ -1444,10 +1444,10 @@ wbt_max_upslope_flowpath_length <- function(dem, output, wd=NULL, verbose_mode=F args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_upslope_flowpath_length" @@ -1493,10 +1493,10 @@ wbt_md_inf_flow_accumulation <- function(dem, output, out_type="specific contrib if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "md_inf_flow_accumulation" @@ -1522,10 +1522,10 @@ wbt_num_inflowing_neighbours <- function(dem, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "num_inflowing_neighbours" @@ -1575,10 +1575,10 @@ wbt_qin_flow_accumulation <- function(dem, output, out_type="specific contributi if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "qin_flow_accumulation" @@ -1624,10 +1624,10 @@ wbt_quinn_flow_accumulation <- function(dem, output, out_type="specific contribu if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "quinn_flow_accumulation" @@ -1663,10 +1663,10 @@ wbt_raise_walls <- function(input, dem, output, breach=NULL, height=100.0, wd=NU if (!is.null(height)) { args <- paste(args, paste0("--height=", height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raise_walls" @@ -1712,10 +1712,10 @@ wbt_rho8_flow_accumulation <- function(input, output, out_type="specific contrib if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rho8_flow_accumulation" @@ -1745,10 +1745,10 @@ wbt_rho8_pointer <- function(dem, output, esri_pntr=FALSE, wd=NULL, verbose_mode if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rho8_pointer" @@ -1778,10 +1778,10 @@ wbt_sink <- function(input, output, zero_background=FALSE, wd=NULL, verbose_mode if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sink" @@ -1811,10 +1811,10 @@ wbt_snap_pour_points <- function(pour_pts, flow_accum, output, snap_dist, wd=NUL args <- paste(args, paste0("--flow_accum=", wbt_file_path(flow_accum))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--snap_dist=", wbt_file_path(snap_dist))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "snap_pour_points" @@ -1848,10 +1848,10 @@ wbt_stochastic_depression_analysis <- function(dem, output, rmse, range, iterati if (!is.null(iterations)) { args <- paste(args, paste0("--iterations=", iterations)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stochastic_depression_analysis" @@ -1883,10 +1883,10 @@ wbt_strahler_order_basins <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "strahler_order_basins" @@ -1918,10 +1918,10 @@ wbt_subbasins <- function(d8_pntr, streams, output, esri_pntr=FALSE, wd=NULL, ve if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "subbasins" @@ -1957,10 +1957,10 @@ wbt_trace_downslope_flowpaths <- function(seed_pts, d8_pntr, output, esri_pntr=F if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "trace_downslope_flowpaths" @@ -1992,10 +1992,10 @@ wbt_unnest_basins <- function(d8_pntr, pour_pts, output, esri_pntr=FALSE, wd=NUL if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "unnest_basins" @@ -2021,10 +2021,10 @@ wbt_upslope_depression_storage <- function(dem, output, wd=NULL, verbose_mode=FA args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "upslope_depression_storage" @@ -2056,10 +2056,10 @@ wbt_watershed <- function(d8_pntr, pour_pts, output, esri_pntr=FALSE, wd=NULL, v if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "watershed" diff --git a/PY2R/scripts/image_analysis.R b/PY2R/scripts/image_analysis.R index a7d894f55..44f61d032 100644 --- a/PY2R/scripts/image_analysis.R +++ b/PY2R/scripts/image_analysis.R @@ -20,10 +20,10 @@ wbt_change_vector_analysis <- function(date1, date2, magnitude, direction, wd=NU args <- paste(args, paste0("--date2=", wbt_file_path(date2))) args <- paste(args, paste0("--magnitude=", wbt_file_path(magnitude))) args <- paste(args, paste0("--direction=", wbt_file_path(direction))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "change_vector_analysis" @@ -57,10 +57,10 @@ wbt_closing <- function(input, output, filterx=11, filtery=11, wd=NULL, verbose_ if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "closing" @@ -102,10 +102,10 @@ wbt_create_colour_composite <- function(red, green, blue, output, opacity=NULL, if (zeros) { args <- paste(args, "--zeros") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_colour_composite" @@ -135,10 +135,10 @@ wbt_flip_image <- function(input, output, direction="vertical", wd=NULL, verbose if (!is.null(direction)) { args <- paste(args, paste0("--direction=", direction)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flip_image" @@ -182,10 +182,10 @@ wbt_ihs_to_rgb <- function(intensity, hue, saturation, red=NULL, green=NULL, blu if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ihs_to_rgb" @@ -241,10 +241,10 @@ wbt_image_slider <- function(input1, input2, output, palette1="grey", reverse1=F if (!is.null(height)) { args <- paste(args, paste0("--height=", height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_slider" @@ -272,10 +272,10 @@ wbt_image_stack_profile <- function(inputs, points, output, wd=NULL, verbose_mod args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--points=", wbt_file_path(points))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_stack_profile" @@ -301,10 +301,10 @@ wbt_integral_image <- function(input, output, wd=NULL, verbose_mode=FALSE, compr args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "integral_image" @@ -330,10 +330,10 @@ wbt_line_thinning <- function(input, output, wd=NULL, verbose_mode=FALSE, compre args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "line_thinning" @@ -365,10 +365,10 @@ wbt_mosaic <- function(output, inputs=NULL, method="nn", wd=NULL, verbose_mode=F if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mosaic" @@ -404,10 +404,10 @@ wbt_mosaic_with_feathering <- function(input1, input2, output, method="cc", weig if (!is.null(weight)) { args <- paste(args, paste0("--weight=", weight)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mosaic_with_feathering" @@ -443,10 +443,10 @@ wbt_normalized_difference_index <- function(input1, input2, output, clip=0.0, co if (!is.null(correction)) { args <- paste(args, paste0("--correction=", correction)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "normalized_difference_index" @@ -480,10 +480,10 @@ wbt_opening <- function(input, output, filterx=11, filtery=11, wd=NULL, verbose_ if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "opening" @@ -513,10 +513,10 @@ wbt_remove_spurs <- function(input, output, iterations=10, wd=NULL, verbose_mode if (!is.null(iterations)) { args <- paste(args, paste0("--iterations=", iterations)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_spurs" @@ -554,10 +554,10 @@ wbt_resample <- function(inputs, output, cell_size=NULL, base=NULL, method="cc", if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "resample" @@ -601,10 +601,10 @@ wbt_rgb_to_ihs <- function(intensity, hue, saturation, red=NULL, green=NULL, blu if (!is.null(composite)) { args <- paste(args, paste0("--composite=", composite)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rgb_to_ihs" @@ -640,10 +640,10 @@ wbt_split_colour_composite <- function(input, red=NULL, green=NULL, blue=NULL, w if (!is.null(blue)) { args <- paste(args, paste0("--blue=", blue)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "split_colour_composite" @@ -669,10 +669,10 @@ wbt_thicken_raster_line <- function(input, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "thicken_raster_line" @@ -710,10 +710,10 @@ wbt_tophat_transform <- function(input, output, filterx=11, filtery=11, variant= if (!is.null(variant)) { args <- paste(args, paste0("--variant=", variant)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tophat_transform" @@ -745,10 +745,10 @@ wbt_write_function_memory_insertion <- function(input1, input2, output, input3=N if (!is.null(input3)) { args <- paste(args, paste0("--input3=", input3)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "write_function_memory_insertion" @@ -778,10 +778,10 @@ wbt_evaluate_training_sites <- function(inputs, polys, field, output, wd=NULL, v args <- paste(args, paste0("--polys=", wbt_file_path(polys))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "evaluate_training_sites" @@ -815,10 +815,10 @@ wbt_generalize_classified_raster <- function(input, output, min_size=4, method=" if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "generalize_classified_raster" @@ -850,10 +850,10 @@ wbt_generalize_with_similarity <- function(input, similarity, output, min_size=4 if (!is.null(min_size)) { args <- paste(args, paste0("--min_size=", min_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "generalize_with_similarity" @@ -891,10 +891,10 @@ wbt_image_segmentation <- function(inputs, output, threshold=0.5, steps=10, min_ if (!is.null(min_area)) { args <- paste(args, paste0("--min_area=", min_area)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_segmentation" @@ -928,10 +928,10 @@ wbt_min_dist_classification <- function(inputs, polys, field, output, threshold= if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_dist_classification" @@ -961,10 +961,10 @@ wbt_parallelepiped_classification <- function(inputs, polys, field, output, wd=N args <- paste(args, paste0("--polys=", wbt_file_path(polys))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "parallelepiped_classification" @@ -1002,10 +1002,10 @@ wbt_adaptive_filter <- function(input, output, filterx=11, filtery=11, threshold if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "adaptive_filter" @@ -1039,10 +1039,10 @@ wbt_bilateral_filter <- function(input, output, sigma_dist=0.75, sigma_int=1.0, if (!is.null(sigma_int)) { args <- paste(args, paste0("--sigma_int=", sigma_int)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "bilateral_filter" @@ -1084,10 +1084,10 @@ wbt_canny_edge_detection <- function(input, output, sigma=0.5, low=0.05, high=0. if (add_back) { args <- paste(args, "--add_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "canny_edge_detection" @@ -1121,10 +1121,10 @@ wbt_conservative_smoothing_filter <- function(input, output, filterx=3, filtery= if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "conservative_smoothing_filter" @@ -1150,10 +1150,10 @@ wbt_corner_detection <- function(input, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "corner_detection" @@ -1187,10 +1187,10 @@ wbt_diff_of_gaussian_filter <- function(input, output, sigma1=2.0, sigma2=4.0, w if (!is.null(sigma2)) { args <- paste(args, paste0("--sigma2=", sigma2)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "diff_of_gaussian_filter" @@ -1224,10 +1224,10 @@ wbt_diversity_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "diversity_filter" @@ -1259,10 +1259,10 @@ wbt_edge_preserving_mean_filter <- function(input, output, threshold, filter=11, if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_preserving_mean_filter" @@ -1296,10 +1296,10 @@ wbt_emboss_filter <- function(input, output, direction="n", clip=0.0, wd=NULL, v if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "emboss_filter" @@ -1329,10 +1329,10 @@ wbt_fast_almost_gaussian_filter <- function(input, output, sigma=1.8, wd=NULL, v if (!is.null(sigma)) { args <- paste(args, paste0("--sigma=", sigma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fast_almost_gaussian_filter" @@ -1362,10 +1362,10 @@ wbt_gaussian_filter <- function(input, output, sigma=0.75, wd=NULL, verbose_mode if (!is.null(sigma)) { args <- paste(args, paste0("--sigma=", sigma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_filter" @@ -1399,10 +1399,10 @@ wbt_high_pass_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "high_pass_filter" @@ -1440,10 +1440,10 @@ wbt_high_pass_median_filter <- function(input, output, filterx=11, filtery=11, s if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "high_pass_median_filter" @@ -1481,10 +1481,10 @@ wbt_k_nearest_mean_filter <- function(input, output, filterx=11, filtery=11, k=5 if (!is.null(k)) { args <- paste(args, paste0("--k=", k)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "k_nearest_mean_filter" @@ -1518,10 +1518,10 @@ wbt_laplacian_filter <- function(input, output, variant="3x3(1)", clip=0.0, wd=N if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "laplacian_filter" @@ -1551,10 +1551,10 @@ wbt_laplacian_of_gaussian_filter <- function(input, output, sigma=0.75, wd=NULL, if (!is.null(sigma)) { args <- paste(args, paste0("--sigma=", sigma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "laplacian_of_gaussian_filter" @@ -1596,10 +1596,10 @@ wbt_lee_sigma_filter <- function(input, output, filterx=11, filtery=11, sigma=10 if (!is.null(m)) { args <- paste(args, paste0("--m=", m)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lee_sigma_filter" @@ -1637,10 +1637,10 @@ wbt_line_detection_filter <- function(input, output, variant="vertical", absvals if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "line_detection_filter" @@ -1674,10 +1674,10 @@ wbt_majority_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "majority_filter" @@ -1711,10 +1711,10 @@ wbt_maximum_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "maximum_filter" @@ -1748,10 +1748,10 @@ wbt_mean_filter <- function(input, output, filterx=3, filtery=3, wd=NULL, verbos if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mean_filter" @@ -1789,10 +1789,10 @@ wbt_median_filter <- function(input, output, filterx=11, filtery=11, sig_digits= if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "median_filter" @@ -1826,10 +1826,10 @@ wbt_minimum_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_filter" @@ -1863,10 +1863,10 @@ wbt_olympic_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "olympic_filter" @@ -1904,10 +1904,10 @@ wbt_percentile_filter <- function(input, output, filterx=11, filtery=11, sig_dig if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percentile_filter" @@ -1937,10 +1937,10 @@ wbt_prewitt_filter <- function(input, output, clip=0.0, wd=NULL, verbose_mode=FA if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "prewitt_filter" @@ -1974,10 +1974,10 @@ wbt_range_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, ver if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "range_filter" @@ -2007,10 +2007,10 @@ wbt_roberts_cross_filter <- function(input, output, clip=0.0, wd=NULL, verbose_m if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "roberts_cross_filter" @@ -2040,10 +2040,10 @@ wbt_scharr_filter <- function(input, output, clip=0.0, wd=NULL, verbose_mode=FAL if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "scharr_filter" @@ -2077,10 +2077,10 @@ wbt_sobel_filter <- function(input, output, variant="3x3", clip=0.0, wd=NULL, ve if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sobel_filter" @@ -2114,10 +2114,10 @@ wbt_standard_deviation_filter <- function(input, output, filterx=11, filtery=11, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "standard_deviation_filter" @@ -2151,10 +2151,10 @@ wbt_total_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, ver if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "total_filter" @@ -2192,10 +2192,10 @@ wbt_unsharp_masking <- function(input, output, sigma=0.75, amount=100.0, thresho if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "unsharp_masking" @@ -2231,10 +2231,10 @@ wbt_user_defined_weights_filter <- function(input, weights, output, center="cent if (normalize) { args <- paste(args, "--normalize") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "user_defined_weights_filter" @@ -2264,10 +2264,10 @@ wbt_balance_contrast_enhancement <- function(input, output, band_mean=100.0, wd= if (!is.null(band_mean)) { args <- paste(args, paste0("--band_mean=", band_mean)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "balance_contrast_enhancement" @@ -2307,10 +2307,10 @@ wbt_correct_vignetting <- function(input, pp, output, focal_length=304.8, image_ if (!is.null(n)) { args <- paste(args, paste0("--n=", n)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "correct_vignetting" @@ -2344,10 +2344,10 @@ wbt_direct_decorrelation_stretch <- function(input, output, k=0.5, clip=1.0, wd= if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "direct_decorrelation_stretch" @@ -2377,10 +2377,10 @@ wbt_gamma_correction <- function(input, output, gamma=0.5, wd=NULL, verbose_mode if (!is.null(gamma)) { args <- paste(args, paste0("--gamma=", gamma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gamma_correction" @@ -2410,10 +2410,10 @@ wbt_gaussian_contrast_stretch <- function(input, output, num_tones=256, wd=NULL, if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_contrast_stretch" @@ -2443,10 +2443,10 @@ wbt_histogram_equalization <- function(input, output, num_tones=256, wd=NULL, ve if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "histogram_equalization" @@ -2474,10 +2474,10 @@ wbt_histogram_matching <- function(input, histo_file, output, wd=NULL, verbose_m args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--histo_file=", wbt_file_path(histo_file))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "histogram_matching" @@ -2505,10 +2505,10 @@ wbt_histogram_matching_two_images <- function(input1, input2, output, wd=NULL, v args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "histogram_matching_two_images" @@ -2542,10 +2542,10 @@ wbt_min_max_contrast_stretch <- function(input, output, min_val, max_val, num_to if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_max_contrast_stretch" @@ -2591,10 +2591,10 @@ wbt_panchromatic_sharpening <- function(pan, output, red=NULL, green=NULL, blue= if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "panchromatic_sharpening" @@ -2632,10 +2632,10 @@ wbt_percentage_contrast_stretch <- function(input, output, clip=1.0, tail="both" if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percentage_contrast_stretch" @@ -2673,10 +2673,10 @@ wbt_sigmoidal_contrast_stretch <- function(input, output, cutoff=0.0, gain=1.0, if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sigmoidal_contrast_stretch" @@ -2710,10 +2710,10 @@ wbt_standard_deviation_contrast_stretch <- function(input, output, stdev=2.0, nu if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "standard_deviation_contrast_stretch" diff --git a/PY2R/scripts/lidar_analysis.R b/PY2R/scripts/lidar_analysis.R index 4af575fc6..035c7693a 100644 --- a/PY2R/scripts/lidar_analysis.R +++ b/PY2R/scripts/lidar_analysis.R @@ -20,10 +20,10 @@ wbt_ascii_to_las <- function(inputs, pattern, proj=NULL, wd=NULL, verbose_mode=F if (!is.null(proj)) { args <- paste(args, paste0("--proj=", proj)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ascii_to_las" @@ -51,10 +51,10 @@ wbt_classify_buildings_in_lidar <- function(input, buildings, output, wd=NULL, v args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--buildings=", wbt_file_path(buildings))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "classify_buildings_in_lidar" @@ -88,10 +88,10 @@ wbt_classify_overlap_points <- function(input, output, resolution=2.0, filter=FA if (filter) { args <- paste(args, "--filter") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "classify_overlap_points" @@ -119,10 +119,10 @@ wbt_clip_lidar_to_polygon <- function(input, polygons, output, wd=NULL, verbose_ args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clip_lidar_to_polygon" @@ -150,10 +150,10 @@ wbt_erase_polygon_from_lidar <- function(input, polygons, output, wd=NULL, verbo args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "erase_polygon_from_lidar" @@ -183,10 +183,10 @@ wbt_filter_lidar_classes <- function(input, output, exclude_cls=NULL, wd=NULL, v if (!is.null(exclude_cls)) { args <- paste(args, paste0("--exclude_cls=", exclude_cls)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "filter_lidar_classes" @@ -214,10 +214,10 @@ wbt_filter_lidar_scan_angles <- function(input, output, threshold, wd=NULL, verb args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--threshold=", wbt_file_path(threshold))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "filter_lidar_scan_angles" @@ -243,10 +243,10 @@ wbt_find_flightline_edge_points <- function(input, output, wd=NULL, verbose_mode args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_flightline_edge_points" @@ -278,10 +278,10 @@ wbt_flightline_overlap <- function(input, output=NULL, resolution=1.0, wd=NULL, if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flightline_overlap" @@ -309,10 +309,10 @@ wbt_height_above_ground <- function(input, output=NULL, wd=NULL, verbose_mode=FA if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "height_above_ground" @@ -336,10 +336,10 @@ wbt_las_to_ascii <- function(inputs, wd=NULL, verbose_mode=FALSE, compress_raste wbt_init() args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_ascii" @@ -367,10 +367,10 @@ wbt_las_to_laz <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, comp if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_laz" @@ -394,10 +394,10 @@ wbt_las_to_multipoint_shapefile <- function(input, wd=NULL, verbose_mode=FALSE, wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_multipoint_shapefile" @@ -421,10 +421,10 @@ wbt_las_to_shapefile <- function(input, wd=NULL, verbose_mode=FALSE, compress_ra wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_shapefile" @@ -462,10 +462,10 @@ wbt_las_to_zlidar <- function(inputs=NULL, outdir=NULL, compress="brotli", level if (!is.null(level)) { args <- paste(args, paste0("--level=", level)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_zlidar" @@ -493,10 +493,10 @@ wbt_laz_to_las <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, comp if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "laz_to_las" @@ -528,10 +528,10 @@ wbt_lidar_block_maximum <- function(input, output=NULL, resolution=1.0, wd=NULL, if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_block_maximum" @@ -563,10 +563,10 @@ wbt_lidar_block_minimum <- function(input, output=NULL, resolution=1.0, wd=NULL, if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_block_minimum" @@ -600,10 +600,10 @@ wbt_lidar_classify_subset <- function(base, subset, output, subset_class, nonsub if (!is.null(nonsubset_class)) { args <- paste(args, paste0("--nonsubset_class=", nonsubset_class)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_classify_subset" @@ -631,10 +631,10 @@ wbt_lidar_colourize <- function(in_lidar, in_image, output, wd=NULL, verbose_mod args <- paste(args, paste0("--in_lidar=", wbt_file_path(in_lidar))) args <- paste(args, paste0("--in_image=", wbt_file_path(in_image))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_colourize" @@ -694,10 +694,10 @@ wbt_lidar_contour <- function(input, output=NULL, interval=10.0, smooth=5, param if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_contour" @@ -745,10 +745,10 @@ wbt_lidar_digital_surface_model <- function(input, output=NULL, resolution=1.0, if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_digital_surface_model" @@ -794,10 +794,10 @@ wbt_lidar_elevation_slice <- function(input, output, minz=NULL, maxz=NULL, cls=F if (!is.null(outclassval)) { args <- paste(args, paste0("--outclassval=", outclassval)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_elevation_slice" @@ -851,10 +851,10 @@ wbt_lidar_ground_point_filter <- function(input, output, radius=2.0, min_neighbo if (height_above_ground) { args <- paste(args, "--height_above_ground") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_ground_point_filter" @@ -886,10 +886,10 @@ wbt_lidar_hex_binning <- function(input, output, width, orientation="horizontal" if (!is.null(orientation)) { args <- paste(args, paste0("--orientation=", orientation)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_hex_binning" @@ -927,10 +927,10 @@ wbt_lidar_hillshade <- function(input, output, azimuth=315.0, altitude=30.0, rad if (!is.null(radius)) { args <- paste(args, paste0("--radius=", radius)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_hillshade" @@ -964,10 +964,10 @@ wbt_lidar_histogram <- function(input, output, parameter="elevation", clip=1.0, if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_histogram" @@ -1027,10 +1027,10 @@ wbt_lidar_idw_interpolation <- function(input, output=NULL, parameter="elevation if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_idw_interpolation" @@ -1066,10 +1066,10 @@ wbt_lidar_info <- function(input, output=NULL, vlr=TRUE, geokeys=TRUE, wd=NULL, if (geokeys) { args <- paste(args, "--geokeys") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_info" @@ -1095,10 +1095,10 @@ wbt_lidar_join <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_join" @@ -1132,10 +1132,10 @@ wbt_lidar_kappa_index <- function(input1, input2, output, class_accuracy, resolu if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_kappa_index" @@ -1191,10 +1191,10 @@ wbt_lidar_nearest_neighbour_gridding <- function(input, output=NULL, parameter=" if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_nearest_neighbour_gridding" @@ -1246,10 +1246,10 @@ wbt_lidar_point_density <- function(input, output=NULL, returns="all", resolutio if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_point_density" @@ -1277,10 +1277,10 @@ wbt_lidar_point_return_analysis <- function(input, output=NULL, wd=NULL, verbose if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_point_return_analysis" @@ -1332,10 +1332,10 @@ wbt_lidar_point_stats <- function(input, resolution=1.0, num_points=TRUE, num_pu if (predom_class) { args <- paste(args, "--predom_class") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_point_stats" @@ -1393,10 +1393,10 @@ wbt_lidar_ransac_planes <- function(input, output, radius=2.0, num_iter=50, num_ if (last_returns) { args <- paste(args, "--last_returns") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_ransac_planes" @@ -1464,10 +1464,10 @@ wbt_lidar_rbf_interpolation <- function(input, output=NULL, parameter="elevation if (!is.null(weight)) { args <- paste(args, paste0("--weight=", weight)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_rbf_interpolation" @@ -1497,10 +1497,10 @@ wbt_lidar_remove_duplicates <- function(input, output, include_z=FALSE, wd=NULL, if (include_z) { args <- paste(args, "--include_z") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_remove_duplicates" @@ -1542,10 +1542,10 @@ wbt_lidar_remove_outliers <- function(input, output, radius=2.0, elev_diff=50.0, if (classify) { args <- paste(args, "--classify") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_remove_outliers" @@ -1611,10 +1611,10 @@ wbt_lidar_rooftop_analysis <- function(buildings, output, input=NULL, radius=2.0 if (!is.null(altitude)) { args <- paste(args, paste0("--altitude=", altitude)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_rooftop_analysis" @@ -1680,10 +1680,10 @@ wbt_lidar_segmentation <- function(input, output, radius=2.0, num_iter=50, num_s if (ground) { args <- paste(args, "--ground") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_segmentation" @@ -1725,10 +1725,10 @@ wbt_lidar_segmentation_based_filter <- function(input, output, radius=5.0, norm_ if (classify) { args <- paste(args, "--classify") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_segmentation_based_filter" @@ -1766,10 +1766,10 @@ wbt_lidar_shift <- function(input, output, x_shift="", y_shift="", z_shift="", w if (!is.null(z_shift)) { args <- paste(args, paste0("--z_shift=", z_shift)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_shift" @@ -1821,10 +1821,10 @@ wbt_lidar_sibson_interpolation <- function(input, output=NULL, parameter="elevat if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_sibson_interpolation" @@ -1850,10 +1850,10 @@ wbt_lidar_sort_by_time <- function(input, output, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_sort_by_time" @@ -1891,10 +1891,10 @@ wbt_lidar_thin <- function(input, output, resolution=2.0, method="lowest", save_ if (save_filtered) { args <- paste(args, "--save_filtered") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_thin" @@ -1930,10 +1930,10 @@ wbt_lidar_thin_high_density <- function(input, output, density, resolution=1.0, if (save_filtered) { args <- paste(args, "--save_filtered") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_thin_high_density" @@ -1977,10 +1977,10 @@ wbt_lidar_tile <- function(input, width=1000.0, height=1000.0, origin_x=0.0, ori if (!is.null(min_points)) { args <- paste(args, paste0("--min_points=", min_points)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tile" @@ -2010,10 +2010,10 @@ wbt_lidar_tile_footprint <- function(input, output, hull=FALSE, wd=NULL, verbose if (hull) { args <- paste(args, "--hull") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tile_footprint" @@ -2069,10 +2069,10 @@ wbt_lidar_tin_gridding <- function(input, output=NULL, parameter="elevation", re if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tin_gridding" @@ -2102,10 +2102,10 @@ wbt_lidar_tophat_transform <- function(input, output, radius=1.0, wd=NULL, verbo if (!is.null(radius)) { args <- paste(args, paste0("--radius=", radius)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tophat_transform" @@ -2135,10 +2135,10 @@ wbt_normal_vectors <- function(input, output, radius=1.0, wd=NULL, verbose_mode= if (!is.null(radius)) { args <- paste(args, paste0("--radius=", radius)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "normal_vectors" @@ -2166,10 +2166,10 @@ wbt_select_tiles_by_polygon <- function(indir, outdir, polygons, wd=NULL, verbos args <- paste(args, paste0("--indir=", wbt_file_path(indir))) args <- paste(args, paste0("--outdir=", wbt_file_path(outdir))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "select_tiles_by_polygon" @@ -2199,10 +2199,10 @@ wbt_zlidar_to_las <- function(inputs=NULL, outdir=NULL, wd=NULL, verbose_mode=FA if (!is.null(outdir)) { args <- paste(args, paste0("--outdir=", outdir)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "zlidar_to_las" diff --git a/PY2R/scripts/machine_learning.R b/PY2R/scripts/machine_learning.R index eb553de91..d02cc4a4f 100644 --- a/PY2R/scripts/machine_learning.R +++ b/PY2R/scripts/machine_learning.R @@ -28,10 +28,10 @@ wbt_dbscan <- function(inputs, output, scaling="Normalize", search_dist=0.01, mi if (!is.null(min_points)) { args <- paste(args, paste0("--min_points=", min_points)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "dbscan" @@ -79,10 +79,10 @@ wbt_k_means_clustering <- function(inputs, output, classes, out_html=NULL, max_i if (!is.null(min_class_size)) { args <- paste(args, paste0("--min_class_size=", min_class_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "k_means_clustering" @@ -128,10 +128,10 @@ wbt_knn_classification <- function(inputs, training, field, output, scaling="Nor if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "knn_classification" @@ -179,10 +179,10 @@ wbt_knn_regression <- function(inputs, training, field, scaling="Normalize", out if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "knn_regression" @@ -222,10 +222,10 @@ wbt_logistic_regression <- function(inputs, training, field, scaling="Normalize" if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "logistic_regression" @@ -271,10 +271,10 @@ wbt_modified_k_means_clustering <- function(inputs, output, out_html=NULL, start if (!is.null(class_change)) { args <- paste(args, paste0("--class_change=", class_change)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "modified_k_means_clustering" @@ -326,10 +326,10 @@ wbt_random_forest_classification <- function(inputs, training, field, output=NUL if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_forest_classification" @@ -377,10 +377,10 @@ wbt_random_forest_regression <- function(inputs, training, field, output=NULL, n if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_forest_regression" @@ -432,10 +432,10 @@ wbt_svm_classification <- function(inputs, training, field, scaling="Normalize", if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "svm_classification" @@ -487,10 +487,10 @@ wbt_svm_regression <- function(inputs, training, field, scaling="Normalize", out if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "svm_regression" diff --git a/PY2R/scripts/math_stat_analysis.R b/PY2R/scripts/math_stat_analysis.R index 8fa7e279f..953da6e5b 100644 --- a/PY2R/scripts/math_stat_analysis.R +++ b/PY2R/scripts/math_stat_analysis.R @@ -18,10 +18,10 @@ wbt_and <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "and" @@ -49,10 +49,10 @@ wbt_not <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "not" @@ -80,10 +80,10 @@ wbt_or <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compress args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "or" @@ -109,10 +109,10 @@ wbt_absolute_value <- function(input, output, wd=NULL, verbose_mode=FALSE, compr args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "absolute_value" @@ -140,10 +140,10 @@ wbt_add <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "add" @@ -171,10 +171,10 @@ wbt_anova <- function(input, features, output, wd=NULL, verbose_mode=FALSE, comp args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--features=", wbt_file_path(features))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "anova" @@ -200,10 +200,10 @@ wbt_arc_cos <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ras args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arc_cos" @@ -229,10 +229,10 @@ wbt_arc_sin <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ras args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arc_sin" @@ -258,10 +258,10 @@ wbt_arc_tan <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ras args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arc_tan" @@ -287,10 +287,10 @@ wbt_arcosh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arcosh" @@ -316,10 +316,10 @@ wbt_arsinh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arsinh" @@ -345,10 +345,10 @@ wbt_artanh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "artanh" @@ -376,10 +376,10 @@ wbt_atan2 <- function(input_y, input_x, output, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--input_y=", wbt_file_path(input_y))) args <- paste(args, paste0("--input_x=", wbt_file_path(input_x))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "atan2" @@ -407,10 +407,10 @@ wbt_attribute_correlation <- function(input, output=NULL, wd=NULL, verbose_mode= if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_correlation" @@ -450,10 +450,10 @@ wbt_attribute_correlation_neighbourhood_analysis <- function(input, field1, fiel if (!is.null(stat)) { args <- paste(args, paste0("--stat=", stat)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_correlation_neighbourhood_analysis" @@ -481,10 +481,10 @@ wbt_attribute_histogram <- function(input, field, output, wd=NULL, verbose_mode= args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_histogram" @@ -518,10 +518,10 @@ wbt_attribute_scattergram <- function(input, fieldx, fieldy, output, trendline=F if (trendline) { args <- paste(args, "--trendline") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_scattergram" @@ -547,10 +547,10 @@ wbt_ceil <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ceil" @@ -588,10 +588,10 @@ wbt_conditional_evaluation <- function(input, output, statement="", true=NULL, f if (!is.null(false)) { args <- paste(args, paste0("--false=", false)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "conditional_evaluation" @@ -617,10 +617,10 @@ wbt_cos <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cos" @@ -646,10 +646,10 @@ wbt_cosh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cosh" @@ -677,10 +677,10 @@ wbt_crispness_index <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "crispness_index" @@ -708,10 +708,10 @@ wbt_cross_tabulation <- function(input1, input2, output, wd=NULL, verbose_mode=F args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cross_tabulation" @@ -737,10 +737,10 @@ wbt_cumulative_distribution <- function(input, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cumulative_distribution" @@ -766,10 +766,10 @@ wbt_decrement <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "decrement" @@ -797,10 +797,10 @@ wbt_divide <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, comp args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "divide" @@ -828,10 +828,10 @@ wbt_equal_to <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, co args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "equal_to" @@ -857,10 +857,10 @@ wbt_exp <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "exp" @@ -886,10 +886,10 @@ wbt_exp2 <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "exp2" @@ -915,10 +915,10 @@ wbt_floor <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raste args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "floor" @@ -950,10 +950,10 @@ wbt_greater_than <- function(input1, input2, output, incl_equals=FALSE, wd=NULL, if (incl_equals) { args <- paste(args, "--incl_equals") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "greater_than" @@ -983,10 +983,10 @@ wbt_image_autocorrelation <- function(inputs, output, contiguity="Rook", wd=NULL if (!is.null(contiguity)) { args <- paste(args, paste0("--contiguity=", contiguity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_autocorrelation" @@ -1014,10 +1014,10 @@ wbt_image_correlation <- function(inputs, output=NULL, wd=NULL, verbose_mode=FAL if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_correlation" @@ -1055,10 +1055,10 @@ wbt_image_correlation_neighbourhood_analysis <- function(input1, input2, output1 if (!is.null(stat)) { args <- paste(args, paste0("--stat=", stat)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_correlation_neighbourhood_analysis" @@ -1102,10 +1102,10 @@ wbt_image_regression <- function(input1, input2, output, out_residuals=NULL, sta if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_regression" @@ -1131,10 +1131,10 @@ wbt_in_place_add <- function(input1, input2, wd=NULL, verbose_mode=FALSE, compre args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_add" @@ -1160,10 +1160,10 @@ wbt_in_place_divide <- function(input1, input2, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_divide" @@ -1189,10 +1189,10 @@ wbt_in_place_multiply <- function(input1, input2, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_multiply" @@ -1218,10 +1218,10 @@ wbt_in_place_subtract <- function(input1, input2, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_subtract" @@ -1247,10 +1247,10 @@ wbt_increment <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "increment" @@ -1278,10 +1278,10 @@ wbt_integer_division <- function(input1, input2, output, wd=NULL, verbose_mode=F args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "integer_division" @@ -1307,10 +1307,10 @@ wbt_inverse_principal_component_analysis <- function(inputs, report, wd=NULL, ve args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--report=", wbt_file_path(report))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "inverse_principal_component_analysis" @@ -1336,10 +1336,10 @@ wbt_is_no_data <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "is_no_data" @@ -1367,10 +1367,10 @@ wbt_kappa_index <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "kappa_index" @@ -1400,10 +1400,10 @@ wbt_ks_test_for_normality <- function(input, output, num_samples=NULL, wd=NULL, if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ks_test_for_normality" @@ -1435,10 +1435,10 @@ wbt_less_than <- function(input1, input2, output, incl_equals=FALSE, wd=NULL, ve if (incl_equals) { args <- paste(args, "--incl_equals") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "less_than" @@ -1466,10 +1466,10 @@ wbt_list_unique_values <- function(input, field, output, wd=NULL, verbose_mode=F args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "list_unique_values" @@ -1495,10 +1495,10 @@ wbt_ln <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters= args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ln" @@ -1524,10 +1524,10 @@ wbt_log10 <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raste args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "log10" @@ -1553,10 +1553,10 @@ wbt_log2 <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "log2" @@ -1584,10 +1584,10 @@ wbt_max <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max" @@ -1615,10 +1615,10 @@ wbt_min <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min" @@ -1646,10 +1646,10 @@ wbt_modulo <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, comp args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "modulo" @@ -1677,10 +1677,10 @@ wbt_multiply <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, co args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiply" @@ -1706,10 +1706,10 @@ wbt_negate <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "negate" @@ -1737,10 +1737,10 @@ wbt_not_equal_to <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "not_equal_to" @@ -1772,10 +1772,10 @@ wbt_paired_sample_t_test <- function(input1, input2, output, num_samples=NULL, w if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "paired_sample_t_test" @@ -1803,10 +1803,10 @@ wbt_phi_coefficient <- function(input1, input2, output, wd=NULL, verbose_mode=FA args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "phi_coefficient" @@ -1834,10 +1834,10 @@ wbt_power <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compr args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "power" @@ -1871,10 +1871,10 @@ wbt_principal_component_analysis <- function(inputs, output, num_comp=NULL, stan if (standardized) { args <- paste(args, "--standardized") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "principal_component_analysis" @@ -1904,10 +1904,10 @@ wbt_quantiles <- function(input, output, num_quantiles=5, wd=NULL, verbose_mode= if (!is.null(num_quantiles)) { args <- paste(args, paste0("--num_quantiles=", num_quantiles)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "quantiles" @@ -1933,10 +1933,10 @@ wbt_random_field <- function(base, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--base=", wbt_file_path(base))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_field" @@ -1966,10 +1966,10 @@ wbt_random_sample <- function(base, output, num_samples=1000, wd=NULL, verbose_m if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_sample" @@ -1997,10 +1997,10 @@ wbt_raster_calculator <- function(output, statement="", wd=NULL, verbose_mode=FA if (!is.null(statement)) { args <- paste(args, paste0("--statement=", statement)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_calculator" @@ -2026,10 +2026,10 @@ wbt_raster_histogram <- function(input, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_histogram" @@ -2053,10 +2053,10 @@ wbt_raster_summary_stats <- function(input, wd=NULL, verbose_mode=FALSE, compres wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_summary_stats" @@ -2082,10 +2082,10 @@ wbt_reciprocal <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reciprocal" @@ -2123,10 +2123,10 @@ wbt_rescale_value_range <- function(input, output, out_min_val, out_max_val, cli if (!is.null(clip_max)) { args <- paste(args, paste0("--clip_max=", clip_max)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rescale_value_range" @@ -2152,10 +2152,10 @@ wbt_root_mean_square_error <- function(input, base, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--base=", wbt_file_path(base))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "root_mean_square_error" @@ -2181,10 +2181,10 @@ wbt_round <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raste args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "round" @@ -2210,10 +2210,10 @@ wbt_sin <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sin" @@ -2239,10 +2239,10 @@ wbt_sinh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sinh" @@ -2268,10 +2268,10 @@ wbt_square <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "square" @@ -2297,10 +2297,10 @@ wbt_square_root <- function(input, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "square_root" @@ -2328,10 +2328,10 @@ wbt_subtract <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, co args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "subtract" @@ -2357,10 +2357,10 @@ wbt_tan <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tan" @@ -2386,10 +2386,10 @@ wbt_tanh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tanh" @@ -2415,10 +2415,10 @@ wbt_to_degrees <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "to_degrees" @@ -2444,10 +2444,10 @@ wbt_to_radians <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "to_radians" @@ -2477,10 +2477,10 @@ wbt_trend_surface <- function(input, output, order=1, wd=NULL, verbose_mode=FALS if (!is.null(order)) { args <- paste(args, paste0("--order=", order)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "trend_surface" @@ -2514,10 +2514,10 @@ wbt_trend_surface_vector_points <- function(input, field, output, cell_size, ord if (!is.null(order)) { args <- paste(args, paste0("--order=", order)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "trend_surface_vector_points" @@ -2547,10 +2547,10 @@ wbt_truncate <- function(input, output, num_decimals=NULL, wd=NULL, verbose_mode if (!is.null(num_decimals)) { args <- paste(args, paste0("--num_decimals=", num_decimals)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "truncate" @@ -2582,10 +2582,10 @@ wbt_turning_bands_simulation <- function(base, output, range, iterations=1000, w if (!is.null(iterations)) { args <- paste(args, paste0("--iterations=", iterations)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "turning_bands_simulation" @@ -2617,10 +2617,10 @@ wbt_two_sample_ks_test <- function(input1, input2, output, num_samples=NULL, wd= if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "two_sample_ks_test" @@ -2652,10 +2652,10 @@ wbt_wilcoxon_signed_rank_test <- function(input1, input2, output, num_samples=NU if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "wilcoxon_signed_rank_test" @@ -2683,10 +2683,10 @@ wbt_xor <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "xor" @@ -2712,10 +2712,10 @@ wbt_z_scores <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ra args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "z_scores" @@ -2753,10 +2753,10 @@ wbt_zonal_statistics <- function(input, features, output=NULL, stat="mean", out_ if (!is.null(out_table)) { args <- paste(args, paste0("--out_table=", out_table)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "zonal_statistics" diff --git a/PY2R/scripts/precision_agriculture.R b/PY2R/scripts/precision_agriculture.R index 4be6e27a2..b87aad144 100644 --- a/PY2R/scripts/precision_agriculture.R +++ b/PY2R/scripts/precision_agriculture.R @@ -36,10 +36,10 @@ wbt_reconcile_multiple_headers <- function(input, region_field, yield_field, out if (!is.null(mean_tonnage)) { args <- paste(args, paste0("--mean_tonnage=", mean_tonnage)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reconcile_multiple_headers" @@ -77,10 +77,10 @@ wbt_recreate_pass_lines <- function(input, yield_field_name, output_lines, outpu if (ignore_zeros) { args <- paste(args, "--ignore_zeros") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "recreate_pass_lines" @@ -118,10 +118,10 @@ wbt_remove_field_edge_points <- function(input, output, dist=NULL, max_change_in if (flag_edges) { args <- paste(args, "--flag_edges") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_field_edge_points" @@ -167,10 +167,10 @@ wbt_yield_filter <- function(input, yield_field, pass_field, output, width=6.096 if (!is.null(max_yield)) { args <- paste(args, paste0("--max_yield=", max_yield)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "yield_filter" @@ -206,10 +206,10 @@ wbt_yield_map <- function(input, pass_field_name, output, width=6.096, max_chang if (!is.null(max_change_in_heading)) { args <- paste(args, paste0("--max_change_in_heading=", max_change_in_heading)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "yield_map" @@ -253,10 +253,10 @@ wbt_yield_normalization <- function(input, yield_field, output, standardize=FALS if (!is.null(max_yield)) { args <- paste(args, paste0("--max_yield=", max_yield)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "yield_normalization" diff --git a/PY2R/scripts/stream_network_analysis.R b/PY2R/scripts/stream_network_analysis.R index 346580916..33be50d72 100644 --- a/PY2R/scripts/stream_network_analysis.R +++ b/PY2R/scripts/stream_network_analysis.R @@ -26,10 +26,10 @@ wbt_distance_to_outlet <- function(d8_pntr, streams, output, esri_pntr=FALSE, ze if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "distance_to_outlet" @@ -61,10 +61,10 @@ wbt_extract_streams <- function(flow_accum, output, threshold, zero_background=F if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_streams" @@ -102,10 +102,10 @@ wbt_extract_valleys <- function(dem, output, variant="LQ", line_thin=TRUE, filte if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_valleys" @@ -141,10 +141,10 @@ wbt_farthest_channel_head <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "farthest_channel_head" @@ -180,10 +180,10 @@ wbt_find_main_stem <- function(d8_pntr, streams, output, esri_pntr=FALSE, zero_b if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_main_stem" @@ -219,10 +219,10 @@ wbt_hack_stream_order <- function(d8_pntr, streams, output, esri_pntr=FALSE, zer if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hack_stream_order" @@ -258,10 +258,10 @@ wbt_horton_stream_order <- function(d8_pntr, streams, output, esri_pntr=FALSE, z if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "horton_stream_order" @@ -297,10 +297,10 @@ wbt_length_of_upstream_channels <- function(d8_pntr, streams, output, esri_pntr= if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "length_of_upstream_channels" @@ -334,10 +334,10 @@ wbt_long_profile <- function(d8_pntr, streams, dem, output, esri_pntr=FALSE, wd= if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "long_profile" @@ -371,10 +371,10 @@ wbt_long_profile_from_points <- function(d8_pntr, points, dem, output, esri_pntr if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "long_profile_from_points" @@ -406,10 +406,10 @@ wbt_raster_streams_to_vector <- function(streams, d8_pntr, output, esri_pntr=FAL if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_streams_to_vector" @@ -445,10 +445,10 @@ wbt_rasterize_streams <- function(streams, base, output, nodata=TRUE, feature_id if (feature_id) { args <- paste(args, "--feature_id") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rasterize_streams" @@ -482,10 +482,10 @@ wbt_remove_short_streams <- function(d8_pntr, streams, output, min_length, esri_ if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_short_streams" @@ -515,10 +515,10 @@ wbt_repair_stream_vector_topology <- function(input, output, dist="", wd=NULL, v if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "repair_stream_vector_topology" @@ -554,10 +554,10 @@ wbt_shreve_stream_magnitude <- function(d8_pntr, streams, output, esri_pntr=FALS if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shreve_stream_magnitude" @@ -593,10 +593,10 @@ wbt_strahler_stream_order <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "strahler_stream_order" @@ -632,10 +632,10 @@ wbt_stream_link_class <- function(d8_pntr, streams, output, esri_pntr=FALSE, zer if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_class" @@ -671,10 +671,10 @@ wbt_stream_link_identifier <- function(d8_pntr, streams, output, esri_pntr=FALSE if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_identifier" @@ -710,10 +710,10 @@ wbt_stream_link_length <- function(d8_pntr, linkid, output, esri_pntr=FALSE, zer if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_length" @@ -751,10 +751,10 @@ wbt_stream_link_slope <- function(d8_pntr, linkid, dem, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_slope" @@ -792,10 +792,10 @@ wbt_stream_slope_continuous <- function(d8_pntr, streams, dem, output, esri_pntr if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_slope_continuous" @@ -831,10 +831,10 @@ wbt_topological_stream_order <- function(d8_pntr, streams, output, esri_pntr=FAL if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "topological_stream_order" @@ -870,10 +870,10 @@ wbt_tributary_identifier <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tributary_identifier" @@ -909,10 +909,10 @@ wbt_vector_stream_network_analysis <- function(streams, dem, output, cutting_hei if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_stream_network_analysis" diff --git a/PY2R/scripts/terrain_analysis.R b/PY2R/scripts/terrain_analysis.R index c9e0b81f8..b24d0c4b4 100644 --- a/PY2R/scripts/terrain_analysis.R +++ b/PY2R/scripts/terrain_analysis.R @@ -24,10 +24,10 @@ wbt_accumulation_curvature <- function(dem, output, log=FALSE, zfactor=1.0, wd=N if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "accumulation_curvature" @@ -57,10 +57,10 @@ wbt_aspect <- function(dem, output, zfactor=NULL, wd=NULL, verbose_mode=FALSE, c if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "aspect" @@ -96,10 +96,10 @@ wbt_assess_route <- function(routes, dem, output, length="", dist=20, wd=NULL, v if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "assess_route" @@ -129,10 +129,10 @@ wbt_average_normal_vector_angular_deviation <- function(dem, output, filter=11, if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_normal_vector_angular_deviation" @@ -162,10 +162,10 @@ wbt_circular_variance_of_aspect <- function(dem, output, filter=11, wd=NULL, ver if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "circular_variance_of_aspect" @@ -215,10 +215,10 @@ wbt_contours_from_points <- function(input, output, field=NULL, use_z=FALSE, max if (!is.null(smooth)) { args <- paste(args, paste0("--smooth=", smooth)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "contours_from_points" @@ -260,10 +260,10 @@ wbt_contours_from_raster <- function(input, output, interval=10.0, base=0.0, smo if (!is.null(tolerance)) { args <- paste(args, paste0("--tolerance=", tolerance)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "contours_from_raster" @@ -297,10 +297,10 @@ wbt_curvedness <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, verbose if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "curvedness" @@ -334,10 +334,10 @@ wbt_dev_from_mean_elev <- function(dem, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "dev_from_mean_elev" @@ -371,10 +371,10 @@ wbt_diff_from_mean_elev <- function(dem, output, filterx=11, filtery=11, wd=NULL if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "diff_from_mean_elev" @@ -408,10 +408,10 @@ wbt_difference_curvature <- function(dem, output, log=FALSE, zfactor=1.0, wd=NUL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "difference_curvature" @@ -445,10 +445,10 @@ wbt_directional_relief <- function(dem, output, azimuth=0.0, max_dist=NULL, wd=N if (!is.null(max_dist)) { args <- paste(args, paste0("--max_dist=", max_dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "directional_relief" @@ -482,10 +482,10 @@ wbt_downslope_index <- function(dem, output, drop=2.0, out_type="tangent", wd=NU if (!is.null(out_type)) { args <- paste(args, paste0("--out_type=", out_type)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "downslope_index" @@ -523,10 +523,10 @@ wbt_edge_density <- function(dem, output, filter=11, norm_diff=5.0, zfactor=NULL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_density" @@ -552,10 +552,10 @@ wbt_elev_above_pit <- function(dem, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_above_pit" @@ -593,10 +593,10 @@ wbt_elev_percentile <- function(dem, output, filterx=11, filtery=11, sig_digits= if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_percentile" @@ -622,10 +622,10 @@ wbt_elev_relative_to_min_max <- function(dem, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_relative_to_min_max" @@ -653,10 +653,10 @@ wbt_elev_relative_to_watershed_min_max <- function(dem, watersheds, output, wd=N args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--watersheds=", wbt_file_path(watersheds))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_relative_to_watershed_min_max" @@ -716,10 +716,10 @@ wbt_embankment_mapping <- function(dem, road_vec, output, search_dist=2.5, min_r if (remove_embankments) { args <- paste(args, "--remove_embankments") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "embankment_mapping" @@ -757,10 +757,10 @@ wbt_exposure_towards_wind_flux <- function(dem, output, azimuth="", max_dist="", if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "exposure_towards_wind_flux" @@ -806,10 +806,10 @@ wbt_feature_preserving_smoothing <- function(dem, output, filter=11, norm_diff=1 if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "feature_preserving_smoothing" @@ -843,10 +843,10 @@ wbt_fetch_analysis <- function(dem, output, azimuth=0.0, hgt_inc=0.05, wd=NULL, if (!is.null(hgt_inc)) { args <- paste(args, paste0("--hgt_inc=", hgt_inc)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fetch_analysis" @@ -884,10 +884,10 @@ wbt_fill_missing_data <- function(input, output, filter=11, weight=2.0, no_edges if (no_edges) { args <- paste(args, "--no_edges") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_missing_data" @@ -917,10 +917,10 @@ wbt_find_ridges <- function(dem, output, line_thin=TRUE, wd=NULL, verbose_mode=F if (line_thin) { args <- paste(args, "--line_thin") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_ridges" @@ -954,10 +954,10 @@ wbt_gaussian_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_curvature" @@ -1011,10 +1011,10 @@ wbt_gaussian_scale_space <- function(dem, output, output_zscore, output_scale, p if (!is.null(z_factor)) { args <- paste(args, paste0("--z_factor=", z_factor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_scale_space" @@ -1048,10 +1048,10 @@ wbt_generating_function <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "generating_function" @@ -1093,10 +1093,10 @@ wbt_geomorphons <- function(dem, output, search=50, threshold=0.0, tdist=0, form if (forms) { args <- paste(args, "--forms") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "geomorphons" @@ -1134,10 +1134,10 @@ wbt_hillshade <- function(dem, output, azimuth=315.0, altitude=30.0, zfactor=NUL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hillshade" @@ -1171,10 +1171,10 @@ wbt_horizon_angle <- function(dem, output, azimuth=0.0, max_dist=100.0, wd=NULL, if (!is.null(max_dist)) { args <- paste(args, paste0("--max_dist=", max_dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "horizon_angle" @@ -1208,10 +1208,10 @@ wbt_horizontal_excess_curvature <- function(dem, output, log=FALSE, zfactor=1.0, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "horizontal_excess_curvature" @@ -1241,10 +1241,10 @@ wbt_hypsometric_analysis <- function(inputs, output, watershed=NULL, wd=NULL, ve if (!is.null(watershed)) { args <- paste(args, paste0("--watershed=", watershed)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hypsometric_analysis" @@ -1302,10 +1302,10 @@ wbt_hypsometrically_tinted_hillshade <- function(dem, output, altitude=45.0, hs_ if (full_mode) { args <- paste(args, "--full_mode") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hypsometrically_tinted_hillshade" @@ -1349,10 +1349,10 @@ wbt_local_hypsometric_analysis <- function(input, out_mag, out_scale, min_scale= if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "local_hypsometric_analysis" @@ -1382,10 +1382,10 @@ wbt_local_quadratic_regression <- function(dem, output, filter=3, wd=NULL, verbo if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "local_quadratic_regression" @@ -1419,10 +1419,10 @@ wbt_map_off_terrain_objects <- function(dem, output, max_slope=40.0, min_size=1, if (!is.null(min_size)) { args <- paste(args, paste0("--min_size=", min_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "map_off_terrain_objects" @@ -1460,10 +1460,10 @@ wbt_max_anisotropy_dev <- function(dem, out_mag, out_scale, max_scale, min_scale if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_anisotropy_dev" @@ -1501,10 +1501,10 @@ wbt_max_anisotropy_dev_signature <- function(dem, points, output, max_scale, min if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_anisotropy_dev_signature" @@ -1534,10 +1534,10 @@ wbt_max_branch_length <- function(dem, output, log=FALSE, wd=NULL, verbose_mode= if (log) { args <- paste(args, "--log") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_branch_length" @@ -1573,10 +1573,10 @@ wbt_max_difference_from_mean <- function(dem, out_mag, out_scale, min_scale, max if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_difference_from_mean" @@ -1602,10 +1602,10 @@ wbt_max_downslope_elev_change <- function(dem, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_downslope_elev_change" @@ -1641,10 +1641,10 @@ wbt_max_elev_dev_signature <- function(dem, points, output, min_scale, max_scale if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_elev_dev_signature" @@ -1680,10 +1680,10 @@ wbt_max_elevation_deviation <- function(dem, out_mag, out_scale, min_scale, max_ if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_elevation_deviation" @@ -1709,10 +1709,10 @@ wbt_max_upslope_elev_change <- function(dem, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_upslope_elev_change" @@ -1746,10 +1746,10 @@ wbt_maximal_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "maximal_curvature" @@ -1783,10 +1783,10 @@ wbt_mean_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, ve if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mean_curvature" @@ -1812,10 +1812,10 @@ wbt_min_downslope_elev_change <- function(dem, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_downslope_elev_change" @@ -1849,10 +1849,10 @@ wbt_minimal_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimal_curvature" @@ -1890,10 +1890,10 @@ wbt_multidirectional_hillshade <- function(dem, output, altitude=45.0, zfactor=N if (full_mode) { args <- paste(args, "--full_mode") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multidirectional_hillshade" @@ -1941,10 +1941,10 @@ wbt_multiscale_elevation_percentile <- function(dem, out_mag, out_scale, sig_dig if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_elevation_percentile" @@ -1982,10 +1982,10 @@ wbt_multiscale_roughness <- function(dem, out_mag, out_scale, max_scale, min_sca if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_roughness" @@ -2023,10 +2023,10 @@ wbt_multiscale_roughness_signature <- function(dem, points, output, max_scale, m if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_roughness_signature" @@ -2070,10 +2070,10 @@ wbt_multiscale_std_dev_normals <- function(dem, out_mag, out_scale, min_scale=1, if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_std_dev_normals" @@ -2117,10 +2117,10 @@ wbt_multiscale_std_dev_normals_signature <- function(dem, points, output, min_sc if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_std_dev_normals_signature" @@ -2154,10 +2154,10 @@ wbt_multiscale_topographic_position_image <- function(local, meso, broad, output if (!is.null(lightness)) { args <- paste(args, paste0("--lightness=", lightness)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_topographic_position_image" @@ -2183,10 +2183,10 @@ wbt_num_downslope_neighbours <- function(dem, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "num_downslope_neighbours" @@ -2212,10 +2212,10 @@ wbt_num_upslope_neighbours <- function(dem, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "num_upslope_neighbours" @@ -2247,10 +2247,10 @@ wbt_openness <- function(input, pos_output, neg_output, dist=20, wd=NULL, verbos if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "openness" @@ -2292,10 +2292,10 @@ wbt_pennock_landform_class <- function(dem, output, slope=3.0, prof=0.1, plan=0. if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "pennock_landform_class" @@ -2329,10 +2329,10 @@ wbt_percent_elev_range <- function(dem, output, filterx=3, filtery=3, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_elev_range" @@ -2366,10 +2366,10 @@ wbt_plan_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, ve if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "plan_curvature" @@ -2397,10 +2397,10 @@ wbt_profile <- function(lines, surface, output, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--lines=", wbt_file_path(lines))) args <- paste(args, paste0("--surface=", wbt_file_path(surface))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "profile" @@ -2434,10 +2434,10 @@ wbt_profile_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "profile_curvature" @@ -2471,10 +2471,10 @@ wbt_relative_aspect <- function(dem, output, azimuth=0.0, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "relative_aspect" @@ -2508,10 +2508,10 @@ wbt_relative_topographic_position <- function(dem, output, filterx=11, filtery=1 if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "relative_topographic_position" @@ -2545,10 +2545,10 @@ wbt_remove_off_terrain_objects <- function(dem, output, filter=11, slope=15.0, w if (!is.null(slope)) { args <- paste(args, paste0("--slope=", slope)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_off_terrain_objects" @@ -2582,10 +2582,10 @@ wbt_ring_curvature <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, ver if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ring_curvature" @@ -2619,10 +2619,10 @@ wbt_rotor <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, verbose_mode if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rotor" @@ -2652,10 +2652,10 @@ wbt_ruggedness_index <- function(dem, output, zfactor=NULL, wd=NULL, verbose_mod if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ruggedness_index" @@ -2691,10 +2691,10 @@ wbt_sediment_transport_index <- function(sca, slope, output, sca_exponent=0.4, s if (!is.null(slope_exponent)) { args <- paste(args, paste0("--slope_exponent=", slope_exponent)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sediment_transport_index" @@ -2752,10 +2752,10 @@ wbt_shadow_animation <- function(input, output, palette="atlas", max_dist="", da if (!is.null(label)) { args <- paste(args, paste0("--label=", label)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shadow_animation" @@ -2801,10 +2801,10 @@ wbt_shadow_image <- function(input, output, palette="soft", max_dist="", date="2 if (!is.null(location)) { args <- paste(args, paste0("--location=", location)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shadow_image" @@ -2834,10 +2834,10 @@ wbt_shape_index <- function(dem, output, zfactor=1.0, wd=NULL, verbose_mode=FALS if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shape_index" @@ -2871,10 +2871,10 @@ wbt_slope <- function(dem, output, zfactor=NULL, units="degrees", wd=NULL, verbo if (!is.null(units)) { args <- paste(args, paste0("--units=", units)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "slope" @@ -2912,10 +2912,10 @@ wbt_slope_vs_aspect_plot <- function(input, output, bin_size=2.0, min_slope=0.1, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "slope_vs_aspect_plot" @@ -2945,10 +2945,10 @@ wbt_slope_vs_elevation_plot <- function(inputs, output, watershed=NULL, wd=NULL, if (!is.null(watershed)) { args <- paste(args, paste0("--watershed=", watershed)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "slope_vs_elevation_plot" @@ -2986,10 +2986,10 @@ wbt_smooth_vegetation_residual <- function(input, output, max_scale=30, dev_thre if (!is.null(scale_threshold)) { args <- paste(args, paste0("--scale_threshold=", scale_threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "smooth_vegetation_residual" @@ -3019,10 +3019,10 @@ wbt_spherical_std_dev_of_normals <- function(dem, output, filter=11, wd=NULL, ve if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "spherical_std_dev_of_normals" @@ -3060,10 +3060,10 @@ wbt_standard_deviation_of_slope <- function(input, output, zfactor=NULL, filterx if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "standard_deviation_of_slope" @@ -3095,10 +3095,10 @@ wbt_stream_power_index <- function(sca, slope, output, exponent=1.0, wd=NULL, ve if (!is.null(exponent)) { args <- paste(args, paste0("--exponent=", exponent)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_power_index" @@ -3124,10 +3124,10 @@ wbt_surface_area_ratio <- function(dem, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "surface_area_ratio" @@ -3161,10 +3161,10 @@ wbt_tangential_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NU if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tangential_curvature" @@ -3222,10 +3222,10 @@ wbt_time_in_daylight <- function(dem, output, lat, long, az_fraction=10.0, max_d if (!is.null(end_time)) { args <- paste(args, paste0("--end_time=", end_time)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "time_in_daylight" @@ -3283,10 +3283,10 @@ wbt_topographic_position_animation <- function(input, output, palette="bl_yl_rd" if (dev_max) { args <- paste(args, "--dev_max") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "topographic_position_animation" @@ -3320,10 +3320,10 @@ wbt_total_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, v if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "total_curvature" @@ -3357,10 +3357,10 @@ wbt_unsphericity <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, verbo if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "unsphericity" @@ -3394,10 +3394,10 @@ wbt_vertical_excess_curvature <- function(dem, output, log=FALSE, zfactor=1.0, w if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vertical_excess_curvature" @@ -3429,10 +3429,10 @@ wbt_viewshed <- function(dem, stations, output, height=2.0, wd=NULL, verbose_mod if (!is.null(height)) { args <- paste(args, paste0("--height=", height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "viewshed" @@ -3466,10 +3466,10 @@ wbt_visibility_index <- function(dem, output, height=2.0, res_factor=2, wd=NULL, if (!is.null(res_factor)) { args <- paste(args, paste0("--res_factor=", res_factor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "visibility_index" @@ -3497,10 +3497,10 @@ wbt_wetness_index <- function(sca, slope, output, wd=NULL, verbose_mode=FALSE, c args <- paste(args, paste0("--sca=", wbt_file_path(sca))) args <- paste(args, paste0("--slope=", wbt_file_path(slope))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "wetness_index" diff --git a/R/data_tools.R b/R/data_tools.R index 5e4658fe1..5c6465fec 100644 --- a/R/data_tools.R +++ b/R/data_tools.R @@ -14,10 +14,10 @@ wbt_add_point_coordinates_to_table <- function(input, wd=NULL, verbose_mode=FALS wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "add_point_coordinates_to_table" @@ -43,10 +43,10 @@ wbt_clean_vector <- function(input, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clean_vector" @@ -72,10 +72,10 @@ wbt_convert_nodata_to_zero <- function(input, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "convert_nodata_to_zero" @@ -101,10 +101,10 @@ wbt_convert_raster_format <- function(input, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "convert_raster_format" @@ -142,10 +142,10 @@ wbt_csv_points_to_vector <- function(input, output, xfield=0, yfield=1, epsg=NUL if (!is.null(epsg)) { args <- paste(args, paste0("--epsg=", epsg)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "csv_points_to_vector" @@ -175,10 +175,10 @@ wbt_export_table_to_csv <- function(input, output, headers=TRUE, wd=NULL, verbos if (headers) { args <- paste(args, "--headers") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "export_table_to_csv" @@ -208,10 +208,10 @@ wbt_fix_dangling_arcs <- function(input, output, dist="", wd=NULL, verbose_mode= if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fix_dangling_arcs" @@ -243,10 +243,10 @@ wbt_join_tables <- function(input1, pkey, input2, fkey, import_field, wd=NULL, v args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--fkey=", wbt_file_path(fkey))) args <- paste(args, paste0("--import_field=", wbt_file_path(import_field))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "join_tables" @@ -272,10 +272,10 @@ wbt_lines_to_polygons <- function(input, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lines_to_polygons" @@ -309,10 +309,10 @@ wbt_merge_table_with_csv <- function(input, pkey, csv, fkey, import_field=NULL, if (!is.null(import_field)) { args <- paste(args, paste0("--import_field=", import_field)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "merge_table_with_csv" @@ -338,10 +338,10 @@ wbt_merge_vectors <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compr args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "merge_vectors" @@ -369,10 +369,10 @@ wbt_modify_no_data_value <- function(input, new_value="-32768.0", wd=NULL, verbo if (!is.null(new_value)) { args <- paste(args, paste0("--new_value=", new_value)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "modify_no_data_value" @@ -402,10 +402,10 @@ wbt_multi_part_to_single_part <- function(input, output, exclude_holes=TRUE, wd= if (exclude_holes) { args <- paste(args, "--exclude_holes") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multi_part_to_single_part" @@ -443,10 +443,10 @@ wbt_new_raster_from_base <- function(base, output, value="nodata", data_type="fl if (!is.null(cell_size)) { args <- paste(args, paste0("--cell_size=", cell_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "new_raster_from_base" @@ -472,10 +472,10 @@ wbt_polygons_to_lines <- function(input, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygons_to_lines" @@ -499,10 +499,10 @@ wbt_print_geo_tiff_tags <- function(input, wd=NULL, verbose_mode=FALSE, compress wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "print_geo_tiff_tags" @@ -528,10 +528,10 @@ wbt_raster_to_vector_lines <- function(input, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_to_vector_lines" @@ -557,10 +557,10 @@ wbt_raster_to_vector_points <- function(input, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_to_vector_points" @@ -586,10 +586,10 @@ wbt_raster_to_vector_polygons <- function(input, output, wd=NULL, verbose_mode=F args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_to_vector_polygons" @@ -613,10 +613,10 @@ wbt_reinitialize_attribute_table <- function(input, wd=NULL, verbose_mode=FALSE, wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reinitialize_attribute_table" @@ -642,10 +642,10 @@ wbt_remove_polygon_holes <- function(input, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_polygon_holes" @@ -675,10 +675,10 @@ wbt_set_nodata_value <- function(input, output, back_value=0.0, wd=NULL, verbose if (!is.null(back_value)) { args <- paste(args, paste0("--back_value=", back_value)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "set_nodata_value" @@ -708,10 +708,10 @@ wbt_single_part_to_multi_part <- function(input, output, field=NULL, wd=NULL, ve if (!is.null(field)) { args <- paste(args, paste0("--field=", field)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "single_part_to_multi_part" @@ -753,10 +753,10 @@ wbt_vector_lines_to_raster <- function(input, output, field="FID", nodata=TRUE, if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_lines_to_raster" @@ -802,10 +802,10 @@ wbt_vector_points_to_raster <- function(input, output, field="FID", assign="last if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_points_to_raster" @@ -847,10 +847,10 @@ wbt_vector_polygons_to_raster <- function(input, output, field="FID", nodata=TRU if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_polygons_to_raster" diff --git a/R/gis_analysis.R b/R/gis_analysis.R index e31f6cb77..e44288e2d 100644 --- a/R/gis_analysis.R +++ b/R/gis_analysis.R @@ -24,10 +24,10 @@ wbt_aggregate_raster <- function(input, output, agg_factor=2, type="mean", wd=NU if (!is.null(type)) { args <- paste(args, paste0("--type=", type)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "aggregate_raster" @@ -67,10 +67,10 @@ wbt_block_maximum_gridding <- function(input, field, output, use_z=FALSE, cell_s if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "block_maximum_gridding" @@ -110,10 +110,10 @@ wbt_block_minimum_gridding <- function(input, field, output, use_z=FALSE, cell_s if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "block_minimum_gridding" @@ -143,10 +143,10 @@ wbt_centroid <- function(input, output, text_output=FALSE, wd=NULL, verbose_mode if (text_output) { args <- paste(args, "--text_output") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "centroid" @@ -172,10 +172,10 @@ wbt_centroid_vector <- function(input, output, wd=NULL, verbose_mode=FALSE, comp args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "centroid_vector" @@ -209,10 +209,10 @@ wbt_clump <- function(input, output, diag=TRUE, zero_back=FALSE, wd=NULL, verbos if (zero_back) { args <- paste(args, "--zero_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clump" @@ -250,10 +250,10 @@ wbt_construct_vector_tin <- function(input, output, field=NULL, use_z=FALSE, max if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "construct_vector_tin" @@ -285,10 +285,10 @@ wbt_create_hexagonal_vector_grid <- function(input, output, width, orientation=" if (!is.null(orientation)) { args <- paste(args, paste0("--orientation=", orientation)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_hexagonal_vector_grid" @@ -326,10 +326,10 @@ wbt_create_plane <- function(base, output, gradient=15.0, aspect=90.0, constant= if (!is.null(constant)) { args <- paste(args, paste0("--constant=", constant)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_plane" @@ -367,10 +367,10 @@ wbt_create_rectangular_vector_grid <- function(input, output, width, height, xor if (!is.null(yorig)) { args <- paste(args, paste0("--yorig=", yorig)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_rectangular_vector_grid" @@ -404,10 +404,10 @@ wbt_dissolve <- function(input, output, field=NULL, snap=0.0, wd=NULL, verbose_m if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "dissolve" @@ -435,10 +435,10 @@ wbt_eliminate_coincident_points <- function(input, output, tolerance, wd=NULL, v args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--tolerance=", wbt_file_path(tolerance))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "eliminate_coincident_points" @@ -470,10 +470,10 @@ wbt_extend_vector_lines <- function(input, output, dist, extend="both ends", wd= if (!is.null(extend)) { args <- paste(args, paste0("--extend=", extend)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extend_vector_lines" @@ -499,10 +499,10 @@ wbt_extract_nodes <- function(input, output, wd=NULL, verbose_mode=FALSE, compre args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_nodes" @@ -532,10 +532,10 @@ wbt_extract_raster_values_at_points <- function(inputs, points, out_text=FALSE, if (out_text) { args <- paste(args, "--out_text") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_raster_values_at_points" @@ -567,10 +567,10 @@ wbt_filter_raster_features_by_area <- function(input, output, threshold, backgro if (!is.null(background)) { args <- paste(args, paste0("--background=", background)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "filter_raster_features_by_area" @@ -600,10 +600,10 @@ wbt_find_lowest_or_highest_points <- function(input, output, out_type="lowest", if (!is.null(out_type)) { args <- paste(args, paste0("--out_type=", out_type)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_lowest_or_highest_points" @@ -655,10 +655,10 @@ wbt_idw_interpolation <- function(input, field, output, use_z=FALSE, weight=2.0, if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "idw_interpolation" @@ -684,10 +684,10 @@ wbt_layer_footprint <- function(input, output, wd=NULL, verbose_mode=FALSE, comp args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "layer_footprint" @@ -713,10 +713,10 @@ wbt_medoid <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "medoid" @@ -750,10 +750,10 @@ wbt_minimum_bounding_box <- function(input, output, criterion="area", features=T if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_bounding_box" @@ -783,10 +783,10 @@ wbt_minimum_bounding_circle <- function(input, output, features=TRUE, wd=NULL, v if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_bounding_circle" @@ -816,10 +816,10 @@ wbt_minimum_bounding_envelope <- function(input, output, features=TRUE, wd=NULL, if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_bounding_envelope" @@ -849,10 +849,10 @@ wbt_minimum_convex_hull <- function(input, output, features=TRUE, wd=NULL, verbo if (features) { args <- paste(args, "--features") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_convex_hull" @@ -898,10 +898,10 @@ wbt_natural_neighbour_interpolation <- function(input, output, field=NULL, use_z if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "natural_neighbour_interpolation" @@ -945,10 +945,10 @@ wbt_nearest_neighbour_gridding <- function(input, field, output, use_z=FALSE, ce if (!is.null(max_dist)) { args <- paste(args, paste0("--max_dist=", max_dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "nearest_neighbour_gridding" @@ -972,10 +972,10 @@ wbt_polygon_area <- function(input, wd=NULL, verbose_mode=FALSE, compress_raster wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_area" @@ -1001,10 +1001,10 @@ wbt_polygon_long_axis <- function(input, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_long_axis" @@ -1028,10 +1028,10 @@ wbt_polygon_perimeter <- function(input, wd=NULL, verbose_mode=FALSE, compress_r wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_perimeter" @@ -1057,10 +1057,10 @@ wbt_polygon_short_axis <- function(input, output, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygon_short_axis" @@ -1120,10 +1120,10 @@ wbt_radial_basis_function_interpolation <- function(input, field, output, use_z= if (!is.null(base)) { args <- paste(args, paste0("--base=", base)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "radial_basis_function_interpolation" @@ -1163,10 +1163,10 @@ wbt_raster_area <- function(input, output=NULL, out_text=FALSE, units="grid cell if (zero_back) { args <- paste(args, "--zero_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_area" @@ -1196,10 +1196,10 @@ wbt_raster_cell_assignment <- function(input, output, assign="column", wd=NULL, if (!is.null(assign)) { args <- paste(args, paste0("--assign=", assign)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_cell_assignment" @@ -1239,10 +1239,10 @@ wbt_raster_perimeter <- function(input, output=NULL, out_text=FALSE, units="grid if (zero_back) { args <- paste(args, "--zero_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_perimeter" @@ -1274,10 +1274,10 @@ wbt_reclass <- function(input, output, reclass_vals, assign_mode=FALSE, wd=NULL, if (assign_mode) { args <- paste(args, "--assign_mode") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reclass" @@ -1315,10 +1315,10 @@ wbt_reclass_equal_interval <- function(input, output, interval=10.0, start_val=N if (!is.null(end_val)) { args <- paste(args, paste0("--end_val=", end_val)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reclass_equal_interval" @@ -1346,10 +1346,10 @@ wbt_reclass_from_file <- function(input, reclass_file, output, wd=NULL, verbose_ args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--reclass_file=", wbt_file_path(reclass_file))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reclass_from_file" @@ -1379,10 +1379,10 @@ wbt_smooth_vectors <- function(input, output, filter=3, wd=NULL, verbose_mode=FA if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "smooth_vectors" @@ -1412,10 +1412,10 @@ wbt_split_vector_lines <- function(input, output, length=NULL, wd=NULL, verbose_ if (!is.null(length)) { args <- paste(args, paste0("--length=", length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "split_vector_lines" @@ -1461,10 +1461,10 @@ wbt_tin_gridding <- function(input, output, field=NULL, use_z=FALSE, resolution= if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tin_gridding" @@ -1496,10 +1496,10 @@ wbt_vector_hex_binning <- function(input, output, width, orientation="horizontal if (!is.null(orientation)) { args <- paste(args, paste0("--orientation=", orientation)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_hex_binning" @@ -1525,10 +1525,10 @@ wbt_voronoi_diagram <- function(input, output, wd=NULL, verbose_mode=FALSE, comp args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "voronoi_diagram" @@ -1560,10 +1560,10 @@ wbt_buffer_raster <- function(input, output, size, gridcells=FALSE, wd=NULL, ver if (gridcells) { args <- paste(args, "--gridcells") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "buffer_raster" @@ -1591,10 +1591,10 @@ wbt_cost_allocation <- function(source, backlink, output, wd=NULL, verbose_mode= args <- paste(args, paste0("--source=", wbt_file_path(source))) args <- paste(args, paste0("--backlink=", wbt_file_path(backlink))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cost_allocation" @@ -1624,10 +1624,10 @@ wbt_cost_distance <- function(source, cost, out_accum, out_backlink, wd=NULL, ve args <- paste(args, paste0("--cost=", wbt_file_path(cost))) args <- paste(args, paste0("--out_accum=", wbt_file_path(out_accum))) args <- paste(args, paste0("--out_backlink=", wbt_file_path(out_backlink))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cost_distance" @@ -1659,10 +1659,10 @@ wbt_cost_pathway <- function(destination, backlink, output, zero_background=FALS if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cost_pathway" @@ -1688,10 +1688,10 @@ wbt_euclidean_allocation <- function(input, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "euclidean_allocation" @@ -1717,10 +1717,10 @@ wbt_euclidean_distance <- function(input, output, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "euclidean_distance" @@ -1746,10 +1746,10 @@ wbt_average_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_overlay" @@ -1777,10 +1777,10 @@ wbt_clip <- function(input, clip, output, wd=NULL, verbose_mode=FALSE, compress_ args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--clip=", wbt_file_path(clip))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clip" @@ -1812,10 +1812,10 @@ wbt_clip_raster_to_polygon <- function(input, polygons, output, maintain_dimensi if (maintain_dimensions) { args <- paste(args, "--maintain_dimensions") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clip_raster_to_polygon" @@ -1843,10 +1843,10 @@ wbt_count_if <- function(inputs, output, value, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--value=", wbt_file_path(value))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "count_if" @@ -1874,10 +1874,10 @@ wbt_difference <- function(input, overlay, output, wd=NULL, verbose_mode=FALSE, args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--overlay=", wbt_file_path(overlay))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "difference" @@ -1905,10 +1905,10 @@ wbt_erase <- function(input, erase, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--erase=", wbt_file_path(erase))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "erase" @@ -1936,10 +1936,10 @@ wbt_erase_polygon_from_raster <- function(input, polygons, output, wd=NULL, verb args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "erase_polygon_from_raster" @@ -1965,10 +1965,10 @@ wbt_highest_position <- function(inputs, output, wd=NULL, verbose_mode=FALSE, co args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "highest_position" @@ -2000,10 +2000,10 @@ wbt_intersect <- function(input, overlay, output, snap=0.0, wd=NULL, verbose_mod if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "intersect" @@ -2031,10 +2031,10 @@ wbt_line_intersections <- function(input1, input2, output, wd=NULL, verbose_mode args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "line_intersections" @@ -2060,10 +2060,10 @@ wbt_lowest_position <- function(inputs, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lowest_position" @@ -2089,10 +2089,10 @@ wbt_max_absolute_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_absolute_overlay" @@ -2118,10 +2118,10 @@ wbt_max_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_overlay" @@ -2151,10 +2151,10 @@ wbt_merge_line_segments <- function(input, output, snap=0.0, wd=NULL, verbose_mo if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "merge_line_segments" @@ -2180,10 +2180,10 @@ wbt_min_absolute_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_absolute_overlay" @@ -2209,10 +2209,10 @@ wbt_min_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_overlay" @@ -2240,10 +2240,10 @@ wbt_percent_equal_to <- function(inputs, comparison, output, wd=NULL, verbose_mo args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--comparison=", wbt_file_path(comparison))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_equal_to" @@ -2271,10 +2271,10 @@ wbt_percent_greater_than <- function(inputs, comparison, output, wd=NULL, verbos args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--comparison=", wbt_file_path(comparison))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_greater_than" @@ -2302,10 +2302,10 @@ wbt_percent_less_than <- function(inputs, comparison, output, wd=NULL, verbose_m args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--comparison=", wbt_file_path(comparison))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_less_than" @@ -2333,10 +2333,10 @@ wbt_pick_from_list <- function(inputs, pos_input, output, wd=NULL, verbose_mode= args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--pos_input=", wbt_file_path(pos_input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "pick_from_list" @@ -2362,10 +2362,10 @@ wbt_polygonize <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "polygonize" @@ -2393,10 +2393,10 @@ wbt_split_with_lines <- function(input, split, output, wd=NULL, verbose_mode=FAL args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--split=", wbt_file_path(split))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "split_with_lines" @@ -2422,10 +2422,10 @@ wbt_sum_overlay <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sum_overlay" @@ -2457,10 +2457,10 @@ wbt_symmetrical_difference <- function(input, overlay, output, snap=0.0, wd=NULL if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "symmetrical_difference" @@ -2492,10 +2492,10 @@ wbt_union <- function(input, overlay, output, snap=0.0, wd=NULL, verbose_mode=FA if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "union" @@ -2523,10 +2523,10 @@ wbt_update_nodata_cells <- function(input1, input2, output, wd=NULL, verbose_mod args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "update_nodata_cells" @@ -2566,10 +2566,10 @@ wbt_weighted_overlay <- function(factors, weights, output, cost=NULL, constraint if (!is.null(scale_max)) { args <- paste(args, paste0("--scale_max=", scale_max)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "weighted_overlay" @@ -2597,10 +2597,10 @@ wbt_weighted_sum <- function(inputs, weights, output, wd=NULL, verbose_mode=FALS args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--weights=", wbt_file_path(weights))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "weighted_sum" @@ -2626,10 +2626,10 @@ wbt_boundary_shape_complexity <- function(input, output, wd=NULL, verbose_mode=F args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "boundary_shape_complexity" @@ -2653,10 +2653,10 @@ wbt_compactness_ratio <- function(input, wd=NULL, verbose_mode=FALSE, compress_r wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "compactness_ratio" @@ -2686,10 +2686,10 @@ wbt_edge_proportion <- function(input, output, output_text=FALSE, wd=NULL, verbo if (output_text) { args <- paste(args, "--output_text") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_proportion" @@ -2713,10 +2713,10 @@ wbt_elongation_ratio <- function(input, wd=NULL, verbose_mode=FALSE, compress_ra wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elongation_ratio" @@ -2742,10 +2742,10 @@ wbt_find_patch_or_class_edge_cells <- function(input, output, wd=NULL, verbose_m args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_patch_or_class_edge_cells" @@ -2769,10 +2769,10 @@ wbt_hole_proportion <- function(input, wd=NULL, verbose_mode=FALSE, compress_ras wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hole_proportion" @@ -2796,10 +2796,10 @@ wbt_linearity_index <- function(input, wd=NULL, verbose_mode=FALSE, compress_ras wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "linearity_index" @@ -2825,10 +2825,10 @@ wbt_narrowness_index <- function(input, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "narrowness_index" @@ -2852,10 +2852,10 @@ wbt_patch_orientation <- function(input, wd=NULL, verbose_mode=FALSE, compress_r wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "patch_orientation" @@ -2879,10 +2879,10 @@ wbt_perimeter_area_ratio <- function(input, wd=NULL, verbose_mode=FALSE, compres wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "perimeter_area_ratio" @@ -2912,10 +2912,10 @@ wbt_radius_of_gyration <- function(input, output, text_output=FALSE, wd=NULL, ve if (text_output) { args <- paste(args, "--text_output") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "radius_of_gyration" @@ -2939,10 +2939,10 @@ wbt_related_circumscribing_circle <- function(input, wd=NULL, verbose_mode=FALSE wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "related_circumscribing_circle" @@ -2966,10 +2966,10 @@ wbt_shape_complexity_index <- function(input, wd=NULL, verbose_mode=FALSE, compr wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shape_complexity_index" @@ -2995,10 +2995,10 @@ wbt_shape_complexity_index_raster <- function(input, output, wd=NULL, verbose_mo args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shape_complexity_index_raster" diff --git a/R/hydro_analysis.R b/R/hydro_analysis.R index bef8430f3..6fb7d95d1 100644 --- a/R/hydro_analysis.R +++ b/R/hydro_analysis.R @@ -16,10 +16,10 @@ wbt_average_flowpath_slope <- function(dem, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_flowpath_slope" @@ -45,10 +45,10 @@ wbt_average_upslope_flowpath_length <- function(dem, output, wd=NULL, verbose_mo args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_upslope_flowpath_length" @@ -78,10 +78,10 @@ wbt_basins <- function(d8_pntr, output, esri_pntr=FALSE, wd=NULL, verbose_mode=F if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "basins" @@ -123,10 +123,10 @@ wbt_breach_depressions <- function(dem, output, max_depth=NULL, max_length=NULL, if (fill_pits) { args <- paste(args, "--fill_pits") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "breach_depressions" @@ -170,10 +170,10 @@ wbt_breach_depressions_least_cost <- function(dem, output, dist, max_cost=NULL, if (fill) { args <- paste(args, "--fill") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "breach_depressions_least_cost" @@ -199,10 +199,10 @@ wbt_breach_single_cell_pits <- function(dem, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "breach_single_cell_pits" @@ -236,10 +236,10 @@ wbt_burn_streams_at_roads <- function(dem, streams, roads, output, width=NULL, w if (!is.null(width)) { args <- paste(args, paste0("--width=", width)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "burn_streams_at_roads" @@ -285,10 +285,10 @@ wbt_d8_flow_accumulation <- function(input, output, out_type="cells", log=FALSE, if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d8_flow_accumulation" @@ -320,10 +320,10 @@ wbt_d8_mass_flux <- function(dem, loading, efficiency, absorption, output, wd=NU args <- paste(args, paste0("--efficiency=", wbt_file_path(efficiency))) args <- paste(args, paste0("--absorption=", wbt_file_path(absorption))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d8_mass_flux" @@ -353,10 +353,10 @@ wbt_d8_pointer <- function(dem, output, esri_pntr=FALSE, wd=NULL, verbose_mode=F if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d8_pointer" @@ -402,10 +402,10 @@ wbt_d_inf_flow_accumulation <- function(input, output, out_type="Specific Contri if (pntr) { args <- paste(args, "--pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d_inf_flow_accumulation" @@ -437,10 +437,10 @@ wbt_d_inf_mass_flux <- function(dem, loading, efficiency, absorption, output, wd args <- paste(args, paste0("--efficiency=", wbt_file_path(efficiency))) args <- paste(args, paste0("--absorption=", wbt_file_path(absorption))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d_inf_mass_flux" @@ -466,10 +466,10 @@ wbt_d_inf_pointer <- function(dem, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "d_inf_pointer" @@ -499,10 +499,10 @@ wbt_depth_in_sink <- function(dem, output, zero_background=FALSE, wd=NULL, verbo if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "depth_in_sink" @@ -534,10 +534,10 @@ wbt_downslope_distance_to_stream <- function(dem, streams, output, dinf=FALSE, w if (dinf) { args <- paste(args, "--dinf") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "downslope_distance_to_stream" @@ -575,10 +575,10 @@ wbt_downslope_flowpath_length <- function(d8_pntr, output, watersheds=NULL, weig if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "downslope_flowpath_length" @@ -612,10 +612,10 @@ wbt_edge_contamination <- function(dem, output, flow_type="mfd", zfactor="", wd= if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_contamination" @@ -643,10 +643,10 @@ wbt_elevation_above_stream <- function(dem, streams, output, wd=NULL, verbose_mo args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elevation_above_stream" @@ -674,10 +674,10 @@ wbt_elevation_above_stream_euclidean <- function(dem, streams, output, wd=NULL, args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elevation_above_stream_euclidean" @@ -723,10 +723,10 @@ wbt_fd8_flow_accumulation <- function(dem, output, out_type="specific contributi if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fd8_flow_accumulation" @@ -752,10 +752,10 @@ wbt_fd8_pointer <- function(dem, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fd8_pointer" @@ -783,10 +783,10 @@ wbt_fill_burn <- function(dem, streams, output, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_burn" @@ -824,10 +824,10 @@ wbt_fill_depressions <- function(dem, output, fix_flats=TRUE, flat_increment=NUL if (!is.null(max_depth)) { args <- paste(args, paste0("--max_depth=", max_depth)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_depressions" @@ -861,10 +861,10 @@ wbt_fill_depressions_planchon_and_darboux <- function(dem, output, fix_flats=TRU if (!is.null(flat_increment)) { args <- paste(args, paste0("--flat_increment=", flat_increment)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_depressions_planchon_and_darboux" @@ -898,10 +898,10 @@ wbt_fill_depressions_wang_and_liu <- function(dem, output, fix_flats=TRUE, flat_ if (!is.null(flat_increment)) { args <- paste(args, paste0("--flat_increment=", flat_increment)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_depressions_wang_and_liu" @@ -927,10 +927,10 @@ wbt_fill_single_cell_pits <- function(dem, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_single_cell_pits" @@ -956,10 +956,10 @@ wbt_find_no_flow_cells <- function(dem, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_no_flow_cells" @@ -987,10 +987,10 @@ wbt_find_parallel_flow <- function(d8_pntr, streams, output, wd=NULL, verbose_mo args <- paste(args, paste0("--d8_pntr=", wbt_file_path(d8_pntr))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_parallel_flow" @@ -1018,10 +1018,10 @@ wbt_flatten_lakes <- function(dem, lakes, output, wd=NULL, verbose_mode=FALSE, c args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--lakes=", wbt_file_path(lakes))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flatten_lakes" @@ -1047,10 +1047,10 @@ wbt_flood_order <- function(dem, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flood_order" @@ -1096,10 +1096,10 @@ wbt_flow_accumulation_full_workflow <- function(dem, out_dem, out_pntr, out_accu if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flow_accumulation_full_workflow" @@ -1129,10 +1129,10 @@ wbt_flow_length_diff <- function(d8_pntr, output, esri_pntr=FALSE, wd=NULL, verb if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flow_length_diff" @@ -1164,10 +1164,10 @@ wbt_hillslopes <- function(d8_pntr, streams, output, esri_pntr=FALSE, wd=NULL, v if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hillslopes" @@ -1203,10 +1203,10 @@ wbt_hydrologic_connectivity <- function(dem, output1, output2, exponent=1.0, thr if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hydrologic_connectivity" @@ -1252,10 +1252,10 @@ wbt_impoundment_size_index <- function(dem, damlength, out_mean=NULL, out_max=NU if (!is.null(out_dam_height)) { args <- paste(args, paste0("--out_dam_height=", out_dam_height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "impoundment_size_index" @@ -1285,10 +1285,10 @@ wbt_insert_dams <- function(dem, dam_pts, output, damlength, wd=NULL, verbose_mo args <- paste(args, paste0("--dam_pts=", wbt_file_path(dam_pts))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--damlength=", wbt_file_path(damlength))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "insert_dams" @@ -1320,10 +1320,10 @@ wbt_isobasins <- function(dem, output, size, connections=FALSE, wd=NULL, verbose if (connections) { args <- paste(args, "--connections") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "isobasins" @@ -1353,10 +1353,10 @@ wbt_jenson_snap_pour_points <- function(pour_pts, streams, output, snap_dist, wd args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--snap_dist=", wbt_file_path(snap_dist))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "jenson_snap_pour_points" @@ -1384,10 +1384,10 @@ wbt_longest_flowpath <- function(dem, basins, output, wd=NULL, verbose_mode=FALS args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--basins=", wbt_file_path(basins))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "longest_flowpath" @@ -1415,10 +1415,10 @@ wbt_low_points_on_headwater_divides <- function(dem, streams, output, wd=NULL, v args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--streams=", wbt_file_path(streams))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "low_points_on_headwater_divides" @@ -1444,10 +1444,10 @@ wbt_max_upslope_flowpath_length <- function(dem, output, wd=NULL, verbose_mode=F args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_upslope_flowpath_length" @@ -1493,10 +1493,10 @@ wbt_md_inf_flow_accumulation <- function(dem, output, out_type="specific contrib if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "md_inf_flow_accumulation" @@ -1522,10 +1522,10 @@ wbt_num_inflowing_neighbours <- function(dem, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "num_inflowing_neighbours" @@ -1575,10 +1575,10 @@ wbt_qin_flow_accumulation <- function(dem, output, out_type="specific contributi if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "qin_flow_accumulation" @@ -1624,10 +1624,10 @@ wbt_quinn_flow_accumulation <- function(dem, output, out_type="specific contribu if (clip) { args <- paste(args, "--clip") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "quinn_flow_accumulation" @@ -1663,10 +1663,10 @@ wbt_raise_walls <- function(input, dem, output, breach=NULL, height=100.0, wd=NU if (!is.null(height)) { args <- paste(args, paste0("--height=", height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raise_walls" @@ -1712,10 +1712,10 @@ wbt_rho8_flow_accumulation <- function(input, output, out_type="specific contrib if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rho8_flow_accumulation" @@ -1745,10 +1745,10 @@ wbt_rho8_pointer <- function(dem, output, esri_pntr=FALSE, wd=NULL, verbose_mode if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rho8_pointer" @@ -1778,10 +1778,10 @@ wbt_sink <- function(input, output, zero_background=FALSE, wd=NULL, verbose_mode if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sink" @@ -1811,10 +1811,10 @@ wbt_snap_pour_points <- function(pour_pts, flow_accum, output, snap_dist, wd=NUL args <- paste(args, paste0("--flow_accum=", wbt_file_path(flow_accum))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--snap_dist=", wbt_file_path(snap_dist))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "snap_pour_points" @@ -1848,10 +1848,10 @@ wbt_stochastic_depression_analysis <- function(dem, output, rmse, range, iterati if (!is.null(iterations)) { args <- paste(args, paste0("--iterations=", iterations)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stochastic_depression_analysis" @@ -1883,10 +1883,10 @@ wbt_strahler_order_basins <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "strahler_order_basins" @@ -1918,10 +1918,10 @@ wbt_subbasins <- function(d8_pntr, streams, output, esri_pntr=FALSE, wd=NULL, ve if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "subbasins" @@ -1957,10 +1957,10 @@ wbt_trace_downslope_flowpaths <- function(seed_pts, d8_pntr, output, esri_pntr=F if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "trace_downslope_flowpaths" @@ -1992,10 +1992,10 @@ wbt_unnest_basins <- function(d8_pntr, pour_pts, output, esri_pntr=FALSE, wd=NUL if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "unnest_basins" @@ -2021,10 +2021,10 @@ wbt_upslope_depression_storage <- function(dem, output, wd=NULL, verbose_mode=FA args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "upslope_depression_storage" @@ -2056,10 +2056,10 @@ wbt_watershed <- function(d8_pntr, pour_pts, output, esri_pntr=FALSE, wd=NULL, v if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "watershed" diff --git a/R/image_analysis.R b/R/image_analysis.R index a7d894f55..44f61d032 100644 --- a/R/image_analysis.R +++ b/R/image_analysis.R @@ -20,10 +20,10 @@ wbt_change_vector_analysis <- function(date1, date2, magnitude, direction, wd=NU args <- paste(args, paste0("--date2=", wbt_file_path(date2))) args <- paste(args, paste0("--magnitude=", wbt_file_path(magnitude))) args <- paste(args, paste0("--direction=", wbt_file_path(direction))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "change_vector_analysis" @@ -57,10 +57,10 @@ wbt_closing <- function(input, output, filterx=11, filtery=11, wd=NULL, verbose_ if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "closing" @@ -102,10 +102,10 @@ wbt_create_colour_composite <- function(red, green, blue, output, opacity=NULL, if (zeros) { args <- paste(args, "--zeros") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "create_colour_composite" @@ -135,10 +135,10 @@ wbt_flip_image <- function(input, output, direction="vertical", wd=NULL, verbose if (!is.null(direction)) { args <- paste(args, paste0("--direction=", direction)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flip_image" @@ -182,10 +182,10 @@ wbt_ihs_to_rgb <- function(intensity, hue, saturation, red=NULL, green=NULL, blu if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ihs_to_rgb" @@ -241,10 +241,10 @@ wbt_image_slider <- function(input1, input2, output, palette1="grey", reverse1=F if (!is.null(height)) { args <- paste(args, paste0("--height=", height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_slider" @@ -272,10 +272,10 @@ wbt_image_stack_profile <- function(inputs, points, output, wd=NULL, verbose_mod args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--points=", wbt_file_path(points))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_stack_profile" @@ -301,10 +301,10 @@ wbt_integral_image <- function(input, output, wd=NULL, verbose_mode=FALSE, compr args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "integral_image" @@ -330,10 +330,10 @@ wbt_line_thinning <- function(input, output, wd=NULL, verbose_mode=FALSE, compre args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "line_thinning" @@ -365,10 +365,10 @@ wbt_mosaic <- function(output, inputs=NULL, method="nn", wd=NULL, verbose_mode=F if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mosaic" @@ -404,10 +404,10 @@ wbt_mosaic_with_feathering <- function(input1, input2, output, method="cc", weig if (!is.null(weight)) { args <- paste(args, paste0("--weight=", weight)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mosaic_with_feathering" @@ -443,10 +443,10 @@ wbt_normalized_difference_index <- function(input1, input2, output, clip=0.0, co if (!is.null(correction)) { args <- paste(args, paste0("--correction=", correction)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "normalized_difference_index" @@ -480,10 +480,10 @@ wbt_opening <- function(input, output, filterx=11, filtery=11, wd=NULL, verbose_ if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "opening" @@ -513,10 +513,10 @@ wbt_remove_spurs <- function(input, output, iterations=10, wd=NULL, verbose_mode if (!is.null(iterations)) { args <- paste(args, paste0("--iterations=", iterations)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_spurs" @@ -554,10 +554,10 @@ wbt_resample <- function(inputs, output, cell_size=NULL, base=NULL, method="cc", if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "resample" @@ -601,10 +601,10 @@ wbt_rgb_to_ihs <- function(intensity, hue, saturation, red=NULL, green=NULL, blu if (!is.null(composite)) { args <- paste(args, paste0("--composite=", composite)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rgb_to_ihs" @@ -640,10 +640,10 @@ wbt_split_colour_composite <- function(input, red=NULL, green=NULL, blue=NULL, w if (!is.null(blue)) { args <- paste(args, paste0("--blue=", blue)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "split_colour_composite" @@ -669,10 +669,10 @@ wbt_thicken_raster_line <- function(input, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "thicken_raster_line" @@ -710,10 +710,10 @@ wbt_tophat_transform <- function(input, output, filterx=11, filtery=11, variant= if (!is.null(variant)) { args <- paste(args, paste0("--variant=", variant)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tophat_transform" @@ -745,10 +745,10 @@ wbt_write_function_memory_insertion <- function(input1, input2, output, input3=N if (!is.null(input3)) { args <- paste(args, paste0("--input3=", input3)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "write_function_memory_insertion" @@ -778,10 +778,10 @@ wbt_evaluate_training_sites <- function(inputs, polys, field, output, wd=NULL, v args <- paste(args, paste0("--polys=", wbt_file_path(polys))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "evaluate_training_sites" @@ -815,10 +815,10 @@ wbt_generalize_classified_raster <- function(input, output, min_size=4, method=" if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "generalize_classified_raster" @@ -850,10 +850,10 @@ wbt_generalize_with_similarity <- function(input, similarity, output, min_size=4 if (!is.null(min_size)) { args <- paste(args, paste0("--min_size=", min_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "generalize_with_similarity" @@ -891,10 +891,10 @@ wbt_image_segmentation <- function(inputs, output, threshold=0.5, steps=10, min_ if (!is.null(min_area)) { args <- paste(args, paste0("--min_area=", min_area)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_segmentation" @@ -928,10 +928,10 @@ wbt_min_dist_classification <- function(inputs, polys, field, output, threshold= if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_dist_classification" @@ -961,10 +961,10 @@ wbt_parallelepiped_classification <- function(inputs, polys, field, output, wd=N args <- paste(args, paste0("--polys=", wbt_file_path(polys))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "parallelepiped_classification" @@ -1002,10 +1002,10 @@ wbt_adaptive_filter <- function(input, output, filterx=11, filtery=11, threshold if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "adaptive_filter" @@ -1039,10 +1039,10 @@ wbt_bilateral_filter <- function(input, output, sigma_dist=0.75, sigma_int=1.0, if (!is.null(sigma_int)) { args <- paste(args, paste0("--sigma_int=", sigma_int)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "bilateral_filter" @@ -1084,10 +1084,10 @@ wbt_canny_edge_detection <- function(input, output, sigma=0.5, low=0.05, high=0. if (add_back) { args <- paste(args, "--add_back") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "canny_edge_detection" @@ -1121,10 +1121,10 @@ wbt_conservative_smoothing_filter <- function(input, output, filterx=3, filtery= if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "conservative_smoothing_filter" @@ -1150,10 +1150,10 @@ wbt_corner_detection <- function(input, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "corner_detection" @@ -1187,10 +1187,10 @@ wbt_diff_of_gaussian_filter <- function(input, output, sigma1=2.0, sigma2=4.0, w if (!is.null(sigma2)) { args <- paste(args, paste0("--sigma2=", sigma2)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "diff_of_gaussian_filter" @@ -1224,10 +1224,10 @@ wbt_diversity_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "diversity_filter" @@ -1259,10 +1259,10 @@ wbt_edge_preserving_mean_filter <- function(input, output, threshold, filter=11, if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_preserving_mean_filter" @@ -1296,10 +1296,10 @@ wbt_emboss_filter <- function(input, output, direction="n", clip=0.0, wd=NULL, v if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "emboss_filter" @@ -1329,10 +1329,10 @@ wbt_fast_almost_gaussian_filter <- function(input, output, sigma=1.8, wd=NULL, v if (!is.null(sigma)) { args <- paste(args, paste0("--sigma=", sigma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fast_almost_gaussian_filter" @@ -1362,10 +1362,10 @@ wbt_gaussian_filter <- function(input, output, sigma=0.75, wd=NULL, verbose_mode if (!is.null(sigma)) { args <- paste(args, paste0("--sigma=", sigma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_filter" @@ -1399,10 +1399,10 @@ wbt_high_pass_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "high_pass_filter" @@ -1440,10 +1440,10 @@ wbt_high_pass_median_filter <- function(input, output, filterx=11, filtery=11, s if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "high_pass_median_filter" @@ -1481,10 +1481,10 @@ wbt_k_nearest_mean_filter <- function(input, output, filterx=11, filtery=11, k=5 if (!is.null(k)) { args <- paste(args, paste0("--k=", k)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "k_nearest_mean_filter" @@ -1518,10 +1518,10 @@ wbt_laplacian_filter <- function(input, output, variant="3x3(1)", clip=0.0, wd=N if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "laplacian_filter" @@ -1551,10 +1551,10 @@ wbt_laplacian_of_gaussian_filter <- function(input, output, sigma=0.75, wd=NULL, if (!is.null(sigma)) { args <- paste(args, paste0("--sigma=", sigma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "laplacian_of_gaussian_filter" @@ -1596,10 +1596,10 @@ wbt_lee_sigma_filter <- function(input, output, filterx=11, filtery=11, sigma=10 if (!is.null(m)) { args <- paste(args, paste0("--m=", m)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lee_sigma_filter" @@ -1637,10 +1637,10 @@ wbt_line_detection_filter <- function(input, output, variant="vertical", absvals if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "line_detection_filter" @@ -1674,10 +1674,10 @@ wbt_majority_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "majority_filter" @@ -1711,10 +1711,10 @@ wbt_maximum_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "maximum_filter" @@ -1748,10 +1748,10 @@ wbt_mean_filter <- function(input, output, filterx=3, filtery=3, wd=NULL, verbos if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mean_filter" @@ -1789,10 +1789,10 @@ wbt_median_filter <- function(input, output, filterx=11, filtery=11, sig_digits= if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "median_filter" @@ -1826,10 +1826,10 @@ wbt_minimum_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimum_filter" @@ -1863,10 +1863,10 @@ wbt_olympic_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "olympic_filter" @@ -1904,10 +1904,10 @@ wbt_percentile_filter <- function(input, output, filterx=11, filtery=11, sig_dig if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percentile_filter" @@ -1937,10 +1937,10 @@ wbt_prewitt_filter <- function(input, output, clip=0.0, wd=NULL, verbose_mode=FA if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "prewitt_filter" @@ -1974,10 +1974,10 @@ wbt_range_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, ver if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "range_filter" @@ -2007,10 +2007,10 @@ wbt_roberts_cross_filter <- function(input, output, clip=0.0, wd=NULL, verbose_m if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "roberts_cross_filter" @@ -2040,10 +2040,10 @@ wbt_scharr_filter <- function(input, output, clip=0.0, wd=NULL, verbose_mode=FAL if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "scharr_filter" @@ -2077,10 +2077,10 @@ wbt_sobel_filter <- function(input, output, variant="3x3", clip=0.0, wd=NULL, ve if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sobel_filter" @@ -2114,10 +2114,10 @@ wbt_standard_deviation_filter <- function(input, output, filterx=11, filtery=11, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "standard_deviation_filter" @@ -2151,10 +2151,10 @@ wbt_total_filter <- function(input, output, filterx=11, filtery=11, wd=NULL, ver if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "total_filter" @@ -2192,10 +2192,10 @@ wbt_unsharp_masking <- function(input, output, sigma=0.75, amount=100.0, thresho if (!is.null(threshold)) { args <- paste(args, paste0("--threshold=", threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "unsharp_masking" @@ -2231,10 +2231,10 @@ wbt_user_defined_weights_filter <- function(input, weights, output, center="cent if (normalize) { args <- paste(args, "--normalize") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "user_defined_weights_filter" @@ -2264,10 +2264,10 @@ wbt_balance_contrast_enhancement <- function(input, output, band_mean=100.0, wd= if (!is.null(band_mean)) { args <- paste(args, paste0("--band_mean=", band_mean)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "balance_contrast_enhancement" @@ -2307,10 +2307,10 @@ wbt_correct_vignetting <- function(input, pp, output, focal_length=304.8, image_ if (!is.null(n)) { args <- paste(args, paste0("--n=", n)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "correct_vignetting" @@ -2344,10 +2344,10 @@ wbt_direct_decorrelation_stretch <- function(input, output, k=0.5, clip=1.0, wd= if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "direct_decorrelation_stretch" @@ -2377,10 +2377,10 @@ wbt_gamma_correction <- function(input, output, gamma=0.5, wd=NULL, verbose_mode if (!is.null(gamma)) { args <- paste(args, paste0("--gamma=", gamma)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gamma_correction" @@ -2410,10 +2410,10 @@ wbt_gaussian_contrast_stretch <- function(input, output, num_tones=256, wd=NULL, if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_contrast_stretch" @@ -2443,10 +2443,10 @@ wbt_histogram_equalization <- function(input, output, num_tones=256, wd=NULL, ve if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "histogram_equalization" @@ -2474,10 +2474,10 @@ wbt_histogram_matching <- function(input, histo_file, output, wd=NULL, verbose_m args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--histo_file=", wbt_file_path(histo_file))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "histogram_matching" @@ -2505,10 +2505,10 @@ wbt_histogram_matching_two_images <- function(input1, input2, output, wd=NULL, v args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "histogram_matching_two_images" @@ -2542,10 +2542,10 @@ wbt_min_max_contrast_stretch <- function(input, output, min_val, max_val, num_to if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_max_contrast_stretch" @@ -2591,10 +2591,10 @@ wbt_panchromatic_sharpening <- function(pan, output, red=NULL, green=NULL, blue= if (!is.null(method)) { args <- paste(args, paste0("--method=", method)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "panchromatic_sharpening" @@ -2632,10 +2632,10 @@ wbt_percentage_contrast_stretch <- function(input, output, clip=1.0, tail="both" if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percentage_contrast_stretch" @@ -2673,10 +2673,10 @@ wbt_sigmoidal_contrast_stretch <- function(input, output, cutoff=0.0, gain=1.0, if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sigmoidal_contrast_stretch" @@ -2710,10 +2710,10 @@ wbt_standard_deviation_contrast_stretch <- function(input, output, stdev=2.0, nu if (!is.null(num_tones)) { args <- paste(args, paste0("--num_tones=", num_tones)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "standard_deviation_contrast_stretch" diff --git a/R/lidar_analysis.R b/R/lidar_analysis.R index 4af575fc6..035c7693a 100644 --- a/R/lidar_analysis.R +++ b/R/lidar_analysis.R @@ -20,10 +20,10 @@ wbt_ascii_to_las <- function(inputs, pattern, proj=NULL, wd=NULL, verbose_mode=F if (!is.null(proj)) { args <- paste(args, paste0("--proj=", proj)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ascii_to_las" @@ -51,10 +51,10 @@ wbt_classify_buildings_in_lidar <- function(input, buildings, output, wd=NULL, v args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--buildings=", wbt_file_path(buildings))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "classify_buildings_in_lidar" @@ -88,10 +88,10 @@ wbt_classify_overlap_points <- function(input, output, resolution=2.0, filter=FA if (filter) { args <- paste(args, "--filter") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "classify_overlap_points" @@ -119,10 +119,10 @@ wbt_clip_lidar_to_polygon <- function(input, polygons, output, wd=NULL, verbose_ args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "clip_lidar_to_polygon" @@ -150,10 +150,10 @@ wbt_erase_polygon_from_lidar <- function(input, polygons, output, wd=NULL, verbo args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "erase_polygon_from_lidar" @@ -183,10 +183,10 @@ wbt_filter_lidar_classes <- function(input, output, exclude_cls=NULL, wd=NULL, v if (!is.null(exclude_cls)) { args <- paste(args, paste0("--exclude_cls=", exclude_cls)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "filter_lidar_classes" @@ -214,10 +214,10 @@ wbt_filter_lidar_scan_angles <- function(input, output, threshold, wd=NULL, verb args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) args <- paste(args, paste0("--threshold=", wbt_file_path(threshold))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "filter_lidar_scan_angles" @@ -243,10 +243,10 @@ wbt_find_flightline_edge_points <- function(input, output, wd=NULL, verbose_mode args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_flightline_edge_points" @@ -278,10 +278,10 @@ wbt_flightline_overlap <- function(input, output=NULL, resolution=1.0, wd=NULL, if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "flightline_overlap" @@ -309,10 +309,10 @@ wbt_height_above_ground <- function(input, output=NULL, wd=NULL, verbose_mode=FA if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "height_above_ground" @@ -336,10 +336,10 @@ wbt_las_to_ascii <- function(inputs, wd=NULL, verbose_mode=FALSE, compress_raste wbt_init() args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_ascii" @@ -367,10 +367,10 @@ wbt_las_to_laz <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, comp if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_laz" @@ -394,10 +394,10 @@ wbt_las_to_multipoint_shapefile <- function(input, wd=NULL, verbose_mode=FALSE, wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_multipoint_shapefile" @@ -421,10 +421,10 @@ wbt_las_to_shapefile <- function(input, wd=NULL, verbose_mode=FALSE, compress_ra wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_shapefile" @@ -462,10 +462,10 @@ wbt_las_to_zlidar <- function(inputs=NULL, outdir=NULL, compress="brotli", level if (!is.null(level)) { args <- paste(args, paste0("--level=", level)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "las_to_zlidar" @@ -493,10 +493,10 @@ wbt_laz_to_las <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, comp if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "laz_to_las" @@ -528,10 +528,10 @@ wbt_lidar_block_maximum <- function(input, output=NULL, resolution=1.0, wd=NULL, if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_block_maximum" @@ -563,10 +563,10 @@ wbt_lidar_block_minimum <- function(input, output=NULL, resolution=1.0, wd=NULL, if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_block_minimum" @@ -600,10 +600,10 @@ wbt_lidar_classify_subset <- function(base, subset, output, subset_class, nonsub if (!is.null(nonsubset_class)) { args <- paste(args, paste0("--nonsubset_class=", nonsubset_class)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_classify_subset" @@ -631,10 +631,10 @@ wbt_lidar_colourize <- function(in_lidar, in_image, output, wd=NULL, verbose_mod args <- paste(args, paste0("--in_lidar=", wbt_file_path(in_lidar))) args <- paste(args, paste0("--in_image=", wbt_file_path(in_image))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_colourize" @@ -694,10 +694,10 @@ wbt_lidar_contour <- function(input, output=NULL, interval=10.0, smooth=5, param if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_contour" @@ -745,10 +745,10 @@ wbt_lidar_digital_surface_model <- function(input, output=NULL, resolution=1.0, if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_digital_surface_model" @@ -794,10 +794,10 @@ wbt_lidar_elevation_slice <- function(input, output, minz=NULL, maxz=NULL, cls=F if (!is.null(outclassval)) { args <- paste(args, paste0("--outclassval=", outclassval)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_elevation_slice" @@ -851,10 +851,10 @@ wbt_lidar_ground_point_filter <- function(input, output, radius=2.0, min_neighbo if (height_above_ground) { args <- paste(args, "--height_above_ground") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_ground_point_filter" @@ -886,10 +886,10 @@ wbt_lidar_hex_binning <- function(input, output, width, orientation="horizontal" if (!is.null(orientation)) { args <- paste(args, paste0("--orientation=", orientation)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_hex_binning" @@ -927,10 +927,10 @@ wbt_lidar_hillshade <- function(input, output, azimuth=315.0, altitude=30.0, rad if (!is.null(radius)) { args <- paste(args, paste0("--radius=", radius)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_hillshade" @@ -964,10 +964,10 @@ wbt_lidar_histogram <- function(input, output, parameter="elevation", clip=1.0, if (!is.null(clip)) { args <- paste(args, paste0("--clip=", clip)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_histogram" @@ -1027,10 +1027,10 @@ wbt_lidar_idw_interpolation <- function(input, output=NULL, parameter="elevation if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_idw_interpolation" @@ -1066,10 +1066,10 @@ wbt_lidar_info <- function(input, output=NULL, vlr=TRUE, geokeys=TRUE, wd=NULL, if (geokeys) { args <- paste(args, "--geokeys") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_info" @@ -1095,10 +1095,10 @@ wbt_lidar_join <- function(inputs, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_join" @@ -1132,10 +1132,10 @@ wbt_lidar_kappa_index <- function(input1, input2, output, class_accuracy, resolu if (!is.null(resolution)) { args <- paste(args, paste0("--resolution=", resolution)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_kappa_index" @@ -1191,10 +1191,10 @@ wbt_lidar_nearest_neighbour_gridding <- function(input, output=NULL, parameter=" if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_nearest_neighbour_gridding" @@ -1246,10 +1246,10 @@ wbt_lidar_point_density <- function(input, output=NULL, returns="all", resolutio if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_point_density" @@ -1277,10 +1277,10 @@ wbt_lidar_point_return_analysis <- function(input, output=NULL, wd=NULL, verbose if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_point_return_analysis" @@ -1332,10 +1332,10 @@ wbt_lidar_point_stats <- function(input, resolution=1.0, num_points=TRUE, num_pu if (predom_class) { args <- paste(args, "--predom_class") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_point_stats" @@ -1393,10 +1393,10 @@ wbt_lidar_ransac_planes <- function(input, output, radius=2.0, num_iter=50, num_ if (last_returns) { args <- paste(args, "--last_returns") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_ransac_planes" @@ -1464,10 +1464,10 @@ wbt_lidar_rbf_interpolation <- function(input, output=NULL, parameter="elevation if (!is.null(weight)) { args <- paste(args, paste0("--weight=", weight)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_rbf_interpolation" @@ -1497,10 +1497,10 @@ wbt_lidar_remove_duplicates <- function(input, output, include_z=FALSE, wd=NULL, if (include_z) { args <- paste(args, "--include_z") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_remove_duplicates" @@ -1542,10 +1542,10 @@ wbt_lidar_remove_outliers <- function(input, output, radius=2.0, elev_diff=50.0, if (classify) { args <- paste(args, "--classify") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_remove_outliers" @@ -1611,10 +1611,10 @@ wbt_lidar_rooftop_analysis <- function(buildings, output, input=NULL, radius=2.0 if (!is.null(altitude)) { args <- paste(args, paste0("--altitude=", altitude)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_rooftop_analysis" @@ -1680,10 +1680,10 @@ wbt_lidar_segmentation <- function(input, output, radius=2.0, num_iter=50, num_s if (ground) { args <- paste(args, "--ground") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_segmentation" @@ -1725,10 +1725,10 @@ wbt_lidar_segmentation_based_filter <- function(input, output, radius=5.0, norm_ if (classify) { args <- paste(args, "--classify") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_segmentation_based_filter" @@ -1766,10 +1766,10 @@ wbt_lidar_shift <- function(input, output, x_shift="", y_shift="", z_shift="", w if (!is.null(z_shift)) { args <- paste(args, paste0("--z_shift=", z_shift)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_shift" @@ -1821,10 +1821,10 @@ wbt_lidar_sibson_interpolation <- function(input, output=NULL, parameter="elevat if (!is.null(maxz)) { args <- paste(args, paste0("--maxz=", maxz)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_sibson_interpolation" @@ -1850,10 +1850,10 @@ wbt_lidar_sort_by_time <- function(input, output, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_sort_by_time" @@ -1891,10 +1891,10 @@ wbt_lidar_thin <- function(input, output, resolution=2.0, method="lowest", save_ if (save_filtered) { args <- paste(args, "--save_filtered") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_thin" @@ -1930,10 +1930,10 @@ wbt_lidar_thin_high_density <- function(input, output, density, resolution=1.0, if (save_filtered) { args <- paste(args, "--save_filtered") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_thin_high_density" @@ -1977,10 +1977,10 @@ wbt_lidar_tile <- function(input, width=1000.0, height=1000.0, origin_x=0.0, ori if (!is.null(min_points)) { args <- paste(args, paste0("--min_points=", min_points)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tile" @@ -2010,10 +2010,10 @@ wbt_lidar_tile_footprint <- function(input, output, hull=FALSE, wd=NULL, verbose if (hull) { args <- paste(args, "--hull") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tile_footprint" @@ -2069,10 +2069,10 @@ wbt_lidar_tin_gridding <- function(input, output=NULL, parameter="elevation", re if (!is.null(max_triangle_edge_length)) { args <- paste(args, paste0("--max_triangle_edge_length=", max_triangle_edge_length)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tin_gridding" @@ -2102,10 +2102,10 @@ wbt_lidar_tophat_transform <- function(input, output, radius=1.0, wd=NULL, verbo if (!is.null(radius)) { args <- paste(args, paste0("--radius=", radius)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "lidar_tophat_transform" @@ -2135,10 +2135,10 @@ wbt_normal_vectors <- function(input, output, radius=1.0, wd=NULL, verbose_mode= if (!is.null(radius)) { args <- paste(args, paste0("--radius=", radius)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "normal_vectors" @@ -2166,10 +2166,10 @@ wbt_select_tiles_by_polygon <- function(indir, outdir, polygons, wd=NULL, verbos args <- paste(args, paste0("--indir=", wbt_file_path(indir))) args <- paste(args, paste0("--outdir=", wbt_file_path(outdir))) args <- paste(args, paste0("--polygons=", wbt_file_path(polygons))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "select_tiles_by_polygon" @@ -2199,10 +2199,10 @@ wbt_zlidar_to_las <- function(inputs=NULL, outdir=NULL, wd=NULL, verbose_mode=FA if (!is.null(outdir)) { args <- paste(args, paste0("--outdir=", outdir)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "zlidar_to_las" diff --git a/R/machine_learning.R b/R/machine_learning.R index eb553de91..d02cc4a4f 100644 --- a/R/machine_learning.R +++ b/R/machine_learning.R @@ -28,10 +28,10 @@ wbt_dbscan <- function(inputs, output, scaling="Normalize", search_dist=0.01, mi if (!is.null(min_points)) { args <- paste(args, paste0("--min_points=", min_points)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "dbscan" @@ -79,10 +79,10 @@ wbt_k_means_clustering <- function(inputs, output, classes, out_html=NULL, max_i if (!is.null(min_class_size)) { args <- paste(args, paste0("--min_class_size=", min_class_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "k_means_clustering" @@ -128,10 +128,10 @@ wbt_knn_classification <- function(inputs, training, field, output, scaling="Nor if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "knn_classification" @@ -179,10 +179,10 @@ wbt_knn_regression <- function(inputs, training, field, scaling="Normalize", out if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "knn_regression" @@ -222,10 +222,10 @@ wbt_logistic_regression <- function(inputs, training, field, scaling="Normalize" if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "logistic_regression" @@ -271,10 +271,10 @@ wbt_modified_k_means_clustering <- function(inputs, output, out_html=NULL, start if (!is.null(class_change)) { args <- paste(args, paste0("--class_change=", class_change)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "modified_k_means_clustering" @@ -326,10 +326,10 @@ wbt_random_forest_classification <- function(inputs, training, field, output=NUL if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_forest_classification" @@ -377,10 +377,10 @@ wbt_random_forest_regression <- function(inputs, training, field, output=NULL, n if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_forest_regression" @@ -432,10 +432,10 @@ wbt_svm_classification <- function(inputs, training, field, scaling="Normalize", if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "svm_classification" @@ -487,10 +487,10 @@ wbt_svm_regression <- function(inputs, training, field, scaling="Normalize", out if (!is.null(test_proportion)) { args <- paste(args, paste0("--test_proportion=", test_proportion)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "svm_regression" diff --git a/R/math_stat_analysis.R b/R/math_stat_analysis.R index 8fa7e279f..953da6e5b 100644 --- a/R/math_stat_analysis.R +++ b/R/math_stat_analysis.R @@ -18,10 +18,10 @@ wbt_and <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "and" @@ -49,10 +49,10 @@ wbt_not <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "not" @@ -80,10 +80,10 @@ wbt_or <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compress args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "or" @@ -109,10 +109,10 @@ wbt_absolute_value <- function(input, output, wd=NULL, verbose_mode=FALSE, compr args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "absolute_value" @@ -140,10 +140,10 @@ wbt_add <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "add" @@ -171,10 +171,10 @@ wbt_anova <- function(input, features, output, wd=NULL, verbose_mode=FALSE, comp args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--features=", wbt_file_path(features))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "anova" @@ -200,10 +200,10 @@ wbt_arc_cos <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ras args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arc_cos" @@ -229,10 +229,10 @@ wbt_arc_sin <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ras args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arc_sin" @@ -258,10 +258,10 @@ wbt_arc_tan <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ras args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arc_tan" @@ -287,10 +287,10 @@ wbt_arcosh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arcosh" @@ -316,10 +316,10 @@ wbt_arsinh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "arsinh" @@ -345,10 +345,10 @@ wbt_artanh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "artanh" @@ -376,10 +376,10 @@ wbt_atan2 <- function(input_y, input_x, output, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--input_y=", wbt_file_path(input_y))) args <- paste(args, paste0("--input_x=", wbt_file_path(input_x))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "atan2" @@ -407,10 +407,10 @@ wbt_attribute_correlation <- function(input, output=NULL, wd=NULL, verbose_mode= if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_correlation" @@ -450,10 +450,10 @@ wbt_attribute_correlation_neighbourhood_analysis <- function(input, field1, fiel if (!is.null(stat)) { args <- paste(args, paste0("--stat=", stat)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_correlation_neighbourhood_analysis" @@ -481,10 +481,10 @@ wbt_attribute_histogram <- function(input, field, output, wd=NULL, verbose_mode= args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_histogram" @@ -518,10 +518,10 @@ wbt_attribute_scattergram <- function(input, fieldx, fieldy, output, trendline=F if (trendline) { args <- paste(args, "--trendline") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "attribute_scattergram" @@ -547,10 +547,10 @@ wbt_ceil <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ceil" @@ -588,10 +588,10 @@ wbt_conditional_evaluation <- function(input, output, statement="", true=NULL, f if (!is.null(false)) { args <- paste(args, paste0("--false=", false)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "conditional_evaluation" @@ -617,10 +617,10 @@ wbt_cos <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cos" @@ -646,10 +646,10 @@ wbt_cosh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cosh" @@ -677,10 +677,10 @@ wbt_crispness_index <- function(input, output=NULL, wd=NULL, verbose_mode=FALSE, if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "crispness_index" @@ -708,10 +708,10 @@ wbt_cross_tabulation <- function(input1, input2, output, wd=NULL, verbose_mode=F args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cross_tabulation" @@ -737,10 +737,10 @@ wbt_cumulative_distribution <- function(input, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "cumulative_distribution" @@ -766,10 +766,10 @@ wbt_decrement <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "decrement" @@ -797,10 +797,10 @@ wbt_divide <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, comp args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "divide" @@ -828,10 +828,10 @@ wbt_equal_to <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, co args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "equal_to" @@ -857,10 +857,10 @@ wbt_exp <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "exp" @@ -886,10 +886,10 @@ wbt_exp2 <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "exp2" @@ -915,10 +915,10 @@ wbt_floor <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raste args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "floor" @@ -950,10 +950,10 @@ wbt_greater_than <- function(input1, input2, output, incl_equals=FALSE, wd=NULL, if (incl_equals) { args <- paste(args, "--incl_equals") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "greater_than" @@ -983,10 +983,10 @@ wbt_image_autocorrelation <- function(inputs, output, contiguity="Rook", wd=NULL if (!is.null(contiguity)) { args <- paste(args, paste0("--contiguity=", contiguity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_autocorrelation" @@ -1014,10 +1014,10 @@ wbt_image_correlation <- function(inputs, output=NULL, wd=NULL, verbose_mode=FAL if (!is.null(output)) { args <- paste(args, paste0("--output=", output)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_correlation" @@ -1055,10 +1055,10 @@ wbt_image_correlation_neighbourhood_analysis <- function(input1, input2, output1 if (!is.null(stat)) { args <- paste(args, paste0("--stat=", stat)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_correlation_neighbourhood_analysis" @@ -1102,10 +1102,10 @@ wbt_image_regression <- function(input1, input2, output, out_residuals=NULL, sta if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "image_regression" @@ -1131,10 +1131,10 @@ wbt_in_place_add <- function(input1, input2, wd=NULL, verbose_mode=FALSE, compre args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_add" @@ -1160,10 +1160,10 @@ wbt_in_place_divide <- function(input1, input2, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_divide" @@ -1189,10 +1189,10 @@ wbt_in_place_multiply <- function(input1, input2, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_multiply" @@ -1218,10 +1218,10 @@ wbt_in_place_subtract <- function(input1, input2, wd=NULL, verbose_mode=FALSE, c args <- "" args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "in_place_subtract" @@ -1247,10 +1247,10 @@ wbt_increment <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_r args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "increment" @@ -1278,10 +1278,10 @@ wbt_integer_division <- function(input1, input2, output, wd=NULL, verbose_mode=F args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "integer_division" @@ -1307,10 +1307,10 @@ wbt_inverse_principal_component_analysis <- function(inputs, report, wd=NULL, ve args <- "" args <- paste(args, paste0("--inputs=", wbt_file_path(inputs))) args <- paste(args, paste0("--report=", wbt_file_path(report))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "inverse_principal_component_analysis" @@ -1336,10 +1336,10 @@ wbt_is_no_data <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "is_no_data" @@ -1367,10 +1367,10 @@ wbt_kappa_index <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "kappa_index" @@ -1400,10 +1400,10 @@ wbt_ks_test_for_normality <- function(input, output, num_samples=NULL, wd=NULL, if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ks_test_for_normality" @@ -1435,10 +1435,10 @@ wbt_less_than <- function(input1, input2, output, incl_equals=FALSE, wd=NULL, ve if (incl_equals) { args <- paste(args, "--incl_equals") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "less_than" @@ -1466,10 +1466,10 @@ wbt_list_unique_values <- function(input, field, output, wd=NULL, verbose_mode=F args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--field=", wbt_file_path(field))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "list_unique_values" @@ -1495,10 +1495,10 @@ wbt_ln <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters= args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ln" @@ -1524,10 +1524,10 @@ wbt_log10 <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raste args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "log10" @@ -1553,10 +1553,10 @@ wbt_log2 <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "log2" @@ -1584,10 +1584,10 @@ wbt_max <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max" @@ -1615,10 +1615,10 @@ wbt_min <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min" @@ -1646,10 +1646,10 @@ wbt_modulo <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, comp args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "modulo" @@ -1677,10 +1677,10 @@ wbt_multiply <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, co args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiply" @@ -1706,10 +1706,10 @@ wbt_negate <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "negate" @@ -1737,10 +1737,10 @@ wbt_not_equal_to <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "not_equal_to" @@ -1772,10 +1772,10 @@ wbt_paired_sample_t_test <- function(input1, input2, output, num_samples=NULL, w if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "paired_sample_t_test" @@ -1803,10 +1803,10 @@ wbt_phi_coefficient <- function(input1, input2, output, wd=NULL, verbose_mode=FA args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "phi_coefficient" @@ -1834,10 +1834,10 @@ wbt_power <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compr args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "power" @@ -1871,10 +1871,10 @@ wbt_principal_component_analysis <- function(inputs, output, num_comp=NULL, stan if (standardized) { args <- paste(args, "--standardized") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "principal_component_analysis" @@ -1904,10 +1904,10 @@ wbt_quantiles <- function(input, output, num_quantiles=5, wd=NULL, verbose_mode= if (!is.null(num_quantiles)) { args <- paste(args, paste0("--num_quantiles=", num_quantiles)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "quantiles" @@ -1933,10 +1933,10 @@ wbt_random_field <- function(base, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--base=", wbt_file_path(base))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_field" @@ -1966,10 +1966,10 @@ wbt_random_sample <- function(base, output, num_samples=1000, wd=NULL, verbose_m if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "random_sample" @@ -1997,10 +1997,10 @@ wbt_raster_calculator <- function(output, statement="", wd=NULL, verbose_mode=FA if (!is.null(statement)) { args <- paste(args, paste0("--statement=", statement)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_calculator" @@ -2026,10 +2026,10 @@ wbt_raster_histogram <- function(input, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_histogram" @@ -2053,10 +2053,10 @@ wbt_raster_summary_stats <- function(input, wd=NULL, verbose_mode=FALSE, compres wbt_init() args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_summary_stats" @@ -2082,10 +2082,10 @@ wbt_reciprocal <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reciprocal" @@ -2123,10 +2123,10 @@ wbt_rescale_value_range <- function(input, output, out_min_val, out_max_val, cli if (!is.null(clip_max)) { args <- paste(args, paste0("--clip_max=", clip_max)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rescale_value_range" @@ -2152,10 +2152,10 @@ wbt_root_mean_square_error <- function(input, base, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--base=", wbt_file_path(base))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "root_mean_square_error" @@ -2181,10 +2181,10 @@ wbt_round <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raste args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "round" @@ -2210,10 +2210,10 @@ wbt_sin <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sin" @@ -2239,10 +2239,10 @@ wbt_sinh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sinh" @@ -2268,10 +2268,10 @@ wbt_square <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rast args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "square" @@ -2297,10 +2297,10 @@ wbt_square_root <- function(input, output, wd=NULL, verbose_mode=FALSE, compress args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "square_root" @@ -2328,10 +2328,10 @@ wbt_subtract <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, co args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "subtract" @@ -2357,10 +2357,10 @@ wbt_tan <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_rasters args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tan" @@ -2386,10 +2386,10 @@ wbt_tanh <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_raster args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tanh" @@ -2415,10 +2415,10 @@ wbt_to_degrees <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "to_degrees" @@ -2444,10 +2444,10 @@ wbt_to_radians <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "to_radians" @@ -2477,10 +2477,10 @@ wbt_trend_surface <- function(input, output, order=1, wd=NULL, verbose_mode=FALS if (!is.null(order)) { args <- paste(args, paste0("--order=", order)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "trend_surface" @@ -2514,10 +2514,10 @@ wbt_trend_surface_vector_points <- function(input, field, output, cell_size, ord if (!is.null(order)) { args <- paste(args, paste0("--order=", order)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "trend_surface_vector_points" @@ -2547,10 +2547,10 @@ wbt_truncate <- function(input, output, num_decimals=NULL, wd=NULL, verbose_mode if (!is.null(num_decimals)) { args <- paste(args, paste0("--num_decimals=", num_decimals)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "truncate" @@ -2582,10 +2582,10 @@ wbt_turning_bands_simulation <- function(base, output, range, iterations=1000, w if (!is.null(iterations)) { args <- paste(args, paste0("--iterations=", iterations)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "turning_bands_simulation" @@ -2617,10 +2617,10 @@ wbt_two_sample_ks_test <- function(input1, input2, output, num_samples=NULL, wd= if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "two_sample_ks_test" @@ -2652,10 +2652,10 @@ wbt_wilcoxon_signed_rank_test <- function(input1, input2, output, num_samples=NU if (!is.null(num_samples)) { args <- paste(args, paste0("--num_samples=", num_samples)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "wilcoxon_signed_rank_test" @@ -2683,10 +2683,10 @@ wbt_xor <- function(input1, input2, output, wd=NULL, verbose_mode=FALSE, compres args <- paste(args, paste0("--input1=", wbt_file_path(input1))) args <- paste(args, paste0("--input2=", wbt_file_path(input2))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "xor" @@ -2712,10 +2712,10 @@ wbt_z_scores <- function(input, output, wd=NULL, verbose_mode=FALSE, compress_ra args <- "" args <- paste(args, paste0("--input=", wbt_file_path(input))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "z_scores" @@ -2753,10 +2753,10 @@ wbt_zonal_statistics <- function(input, features, output=NULL, stat="mean", out_ if (!is.null(out_table)) { args <- paste(args, paste0("--out_table=", out_table)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "zonal_statistics" diff --git a/R/precision_agriculture.R b/R/precision_agriculture.R index 4be6e27a2..b87aad144 100644 --- a/R/precision_agriculture.R +++ b/R/precision_agriculture.R @@ -36,10 +36,10 @@ wbt_reconcile_multiple_headers <- function(input, region_field, yield_field, out if (!is.null(mean_tonnage)) { args <- paste(args, paste0("--mean_tonnage=", mean_tonnage)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "reconcile_multiple_headers" @@ -77,10 +77,10 @@ wbt_recreate_pass_lines <- function(input, yield_field_name, output_lines, outpu if (ignore_zeros) { args <- paste(args, "--ignore_zeros") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "recreate_pass_lines" @@ -118,10 +118,10 @@ wbt_remove_field_edge_points <- function(input, output, dist=NULL, max_change_in if (flag_edges) { args <- paste(args, "--flag_edges") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_field_edge_points" @@ -167,10 +167,10 @@ wbt_yield_filter <- function(input, yield_field, pass_field, output, width=6.096 if (!is.null(max_yield)) { args <- paste(args, paste0("--max_yield=", max_yield)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "yield_filter" @@ -206,10 +206,10 @@ wbt_yield_map <- function(input, pass_field_name, output, width=6.096, max_chang if (!is.null(max_change_in_heading)) { args <- paste(args, paste0("--max_change_in_heading=", max_change_in_heading)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "yield_map" @@ -253,10 +253,10 @@ wbt_yield_normalization <- function(input, yield_field, output, standardize=FALS if (!is.null(max_yield)) { args <- paste(args, paste0("--max_yield=", max_yield)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "yield_normalization" diff --git a/R/stream_network_analysis.R b/R/stream_network_analysis.R index 346580916..33be50d72 100644 --- a/R/stream_network_analysis.R +++ b/R/stream_network_analysis.R @@ -26,10 +26,10 @@ wbt_distance_to_outlet <- function(d8_pntr, streams, output, esri_pntr=FALSE, ze if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "distance_to_outlet" @@ -61,10 +61,10 @@ wbt_extract_streams <- function(flow_accum, output, threshold, zero_background=F if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_streams" @@ -102,10 +102,10 @@ wbt_extract_valleys <- function(dem, output, variant="LQ", line_thin=TRUE, filte if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "extract_valleys" @@ -141,10 +141,10 @@ wbt_farthest_channel_head <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "farthest_channel_head" @@ -180,10 +180,10 @@ wbt_find_main_stem <- function(d8_pntr, streams, output, esri_pntr=FALSE, zero_b if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_main_stem" @@ -219,10 +219,10 @@ wbt_hack_stream_order <- function(d8_pntr, streams, output, esri_pntr=FALSE, zer if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hack_stream_order" @@ -258,10 +258,10 @@ wbt_horton_stream_order <- function(d8_pntr, streams, output, esri_pntr=FALSE, z if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "horton_stream_order" @@ -297,10 +297,10 @@ wbt_length_of_upstream_channels <- function(d8_pntr, streams, output, esri_pntr= if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "length_of_upstream_channels" @@ -334,10 +334,10 @@ wbt_long_profile <- function(d8_pntr, streams, dem, output, esri_pntr=FALSE, wd= if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "long_profile" @@ -371,10 +371,10 @@ wbt_long_profile_from_points <- function(d8_pntr, points, dem, output, esri_pntr if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "long_profile_from_points" @@ -406,10 +406,10 @@ wbt_raster_streams_to_vector <- function(streams, d8_pntr, output, esri_pntr=FAL if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "raster_streams_to_vector" @@ -445,10 +445,10 @@ wbt_rasterize_streams <- function(streams, base, output, nodata=TRUE, feature_id if (feature_id) { args <- paste(args, "--feature_id") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rasterize_streams" @@ -482,10 +482,10 @@ wbt_remove_short_streams <- function(d8_pntr, streams, output, min_length, esri_ if (esri_pntr) { args <- paste(args, "--esri_pntr") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_short_streams" @@ -515,10 +515,10 @@ wbt_repair_stream_vector_topology <- function(input, output, dist="", wd=NULL, v if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "repair_stream_vector_topology" @@ -554,10 +554,10 @@ wbt_shreve_stream_magnitude <- function(d8_pntr, streams, output, esri_pntr=FALS if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shreve_stream_magnitude" @@ -593,10 +593,10 @@ wbt_strahler_stream_order <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "strahler_stream_order" @@ -632,10 +632,10 @@ wbt_stream_link_class <- function(d8_pntr, streams, output, esri_pntr=FALSE, zer if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_class" @@ -671,10 +671,10 @@ wbt_stream_link_identifier <- function(d8_pntr, streams, output, esri_pntr=FALSE if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_identifier" @@ -710,10 +710,10 @@ wbt_stream_link_length <- function(d8_pntr, linkid, output, esri_pntr=FALSE, zer if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_length" @@ -751,10 +751,10 @@ wbt_stream_link_slope <- function(d8_pntr, linkid, dem, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_link_slope" @@ -792,10 +792,10 @@ wbt_stream_slope_continuous <- function(d8_pntr, streams, dem, output, esri_pntr if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_slope_continuous" @@ -831,10 +831,10 @@ wbt_topological_stream_order <- function(d8_pntr, streams, output, esri_pntr=FAL if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "topological_stream_order" @@ -870,10 +870,10 @@ wbt_tributary_identifier <- function(d8_pntr, streams, output, esri_pntr=FALSE, if (zero_background) { args <- paste(args, "--zero_background") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tributary_identifier" @@ -909,10 +909,10 @@ wbt_vector_stream_network_analysis <- function(streams, dem, output, cutting_hei if (!is.null(snap)) { args <- paste(args, paste0("--snap=", snap)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vector_stream_network_analysis" diff --git a/R/terrain_analysis.R b/R/terrain_analysis.R index c9e0b81f8..b24d0c4b4 100644 --- a/R/terrain_analysis.R +++ b/R/terrain_analysis.R @@ -24,10 +24,10 @@ wbt_accumulation_curvature <- function(dem, output, log=FALSE, zfactor=1.0, wd=N if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "accumulation_curvature" @@ -57,10 +57,10 @@ wbt_aspect <- function(dem, output, zfactor=NULL, wd=NULL, verbose_mode=FALSE, c if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "aspect" @@ -96,10 +96,10 @@ wbt_assess_route <- function(routes, dem, output, length="", dist=20, wd=NULL, v if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "assess_route" @@ -129,10 +129,10 @@ wbt_average_normal_vector_angular_deviation <- function(dem, output, filter=11, if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "average_normal_vector_angular_deviation" @@ -162,10 +162,10 @@ wbt_circular_variance_of_aspect <- function(dem, output, filter=11, wd=NULL, ver if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "circular_variance_of_aspect" @@ -215,10 +215,10 @@ wbt_contours_from_points <- function(input, output, field=NULL, use_z=FALSE, max if (!is.null(smooth)) { args <- paste(args, paste0("--smooth=", smooth)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "contours_from_points" @@ -260,10 +260,10 @@ wbt_contours_from_raster <- function(input, output, interval=10.0, base=0.0, smo if (!is.null(tolerance)) { args <- paste(args, paste0("--tolerance=", tolerance)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "contours_from_raster" @@ -297,10 +297,10 @@ wbt_curvedness <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, verbose if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "curvedness" @@ -334,10 +334,10 @@ wbt_dev_from_mean_elev <- function(dem, output, filterx=11, filtery=11, wd=NULL, if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "dev_from_mean_elev" @@ -371,10 +371,10 @@ wbt_diff_from_mean_elev <- function(dem, output, filterx=11, filtery=11, wd=NULL if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "diff_from_mean_elev" @@ -408,10 +408,10 @@ wbt_difference_curvature <- function(dem, output, log=FALSE, zfactor=1.0, wd=NUL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "difference_curvature" @@ -445,10 +445,10 @@ wbt_directional_relief <- function(dem, output, azimuth=0.0, max_dist=NULL, wd=N if (!is.null(max_dist)) { args <- paste(args, paste0("--max_dist=", max_dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "directional_relief" @@ -482,10 +482,10 @@ wbt_downslope_index <- function(dem, output, drop=2.0, out_type="tangent", wd=NU if (!is.null(out_type)) { args <- paste(args, paste0("--out_type=", out_type)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "downslope_index" @@ -523,10 +523,10 @@ wbt_edge_density <- function(dem, output, filter=11, norm_diff=5.0, zfactor=NULL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "edge_density" @@ -552,10 +552,10 @@ wbt_elev_above_pit <- function(dem, output, wd=NULL, verbose_mode=FALSE, compres args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_above_pit" @@ -593,10 +593,10 @@ wbt_elev_percentile <- function(dem, output, filterx=11, filtery=11, sig_digits= if (!is.null(sig_digits)) { args <- paste(args, paste0("--sig_digits=", sig_digits)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_percentile" @@ -622,10 +622,10 @@ wbt_elev_relative_to_min_max <- function(dem, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_relative_to_min_max" @@ -653,10 +653,10 @@ wbt_elev_relative_to_watershed_min_max <- function(dem, watersheds, output, wd=N args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--watersheds=", wbt_file_path(watersheds))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "elev_relative_to_watershed_min_max" @@ -716,10 +716,10 @@ wbt_embankment_mapping <- function(dem, road_vec, output, search_dist=2.5, min_r if (remove_embankments) { args <- paste(args, "--remove_embankments") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "embankment_mapping" @@ -757,10 +757,10 @@ wbt_exposure_towards_wind_flux <- function(dem, output, azimuth="", max_dist="", if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "exposure_towards_wind_flux" @@ -806,10 +806,10 @@ wbt_feature_preserving_smoothing <- function(dem, output, filter=11, norm_diff=1 if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "feature_preserving_smoothing" @@ -843,10 +843,10 @@ wbt_fetch_analysis <- function(dem, output, azimuth=0.0, hgt_inc=0.05, wd=NULL, if (!is.null(hgt_inc)) { args <- paste(args, paste0("--hgt_inc=", hgt_inc)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fetch_analysis" @@ -884,10 +884,10 @@ wbt_fill_missing_data <- function(input, output, filter=11, weight=2.0, no_edges if (no_edges) { args <- paste(args, "--no_edges") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "fill_missing_data" @@ -917,10 +917,10 @@ wbt_find_ridges <- function(dem, output, line_thin=TRUE, wd=NULL, verbose_mode=F if (line_thin) { args <- paste(args, "--line_thin") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "find_ridges" @@ -954,10 +954,10 @@ wbt_gaussian_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_curvature" @@ -1011,10 +1011,10 @@ wbt_gaussian_scale_space <- function(dem, output, output_zscore, output_scale, p if (!is.null(z_factor)) { args <- paste(args, paste0("--z_factor=", z_factor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "gaussian_scale_space" @@ -1048,10 +1048,10 @@ wbt_generating_function <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "generating_function" @@ -1093,10 +1093,10 @@ wbt_geomorphons <- function(dem, output, search=50, threshold=0.0, tdist=0, form if (forms) { args <- paste(args, "--forms") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "geomorphons" @@ -1134,10 +1134,10 @@ wbt_hillshade <- function(dem, output, azimuth=315.0, altitude=30.0, zfactor=NUL if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hillshade" @@ -1171,10 +1171,10 @@ wbt_horizon_angle <- function(dem, output, azimuth=0.0, max_dist=100.0, wd=NULL, if (!is.null(max_dist)) { args <- paste(args, paste0("--max_dist=", max_dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "horizon_angle" @@ -1208,10 +1208,10 @@ wbt_horizontal_excess_curvature <- function(dem, output, log=FALSE, zfactor=1.0, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "horizontal_excess_curvature" @@ -1241,10 +1241,10 @@ wbt_hypsometric_analysis <- function(inputs, output, watershed=NULL, wd=NULL, ve if (!is.null(watershed)) { args <- paste(args, paste0("--watershed=", watershed)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hypsometric_analysis" @@ -1302,10 +1302,10 @@ wbt_hypsometrically_tinted_hillshade <- function(dem, output, altitude=45.0, hs_ if (full_mode) { args <- paste(args, "--full_mode") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "hypsometrically_tinted_hillshade" @@ -1349,10 +1349,10 @@ wbt_local_hypsometric_analysis <- function(input, out_mag, out_scale, min_scale= if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "local_hypsometric_analysis" @@ -1382,10 +1382,10 @@ wbt_local_quadratic_regression <- function(dem, output, filter=3, wd=NULL, verbo if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "local_quadratic_regression" @@ -1419,10 +1419,10 @@ wbt_map_off_terrain_objects <- function(dem, output, max_slope=40.0, min_size=1, if (!is.null(min_size)) { args <- paste(args, paste0("--min_size=", min_size)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "map_off_terrain_objects" @@ -1460,10 +1460,10 @@ wbt_max_anisotropy_dev <- function(dem, out_mag, out_scale, max_scale, min_scale if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_anisotropy_dev" @@ -1501,10 +1501,10 @@ wbt_max_anisotropy_dev_signature <- function(dem, points, output, max_scale, min if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_anisotropy_dev_signature" @@ -1534,10 +1534,10 @@ wbt_max_branch_length <- function(dem, output, log=FALSE, wd=NULL, verbose_mode= if (log) { args <- paste(args, "--log") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_branch_length" @@ -1573,10 +1573,10 @@ wbt_max_difference_from_mean <- function(dem, out_mag, out_scale, min_scale, max if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_difference_from_mean" @@ -1602,10 +1602,10 @@ wbt_max_downslope_elev_change <- function(dem, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_downslope_elev_change" @@ -1641,10 +1641,10 @@ wbt_max_elev_dev_signature <- function(dem, points, output, min_scale, max_scale if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_elev_dev_signature" @@ -1680,10 +1680,10 @@ wbt_max_elevation_deviation <- function(dem, out_mag, out_scale, min_scale, max_ if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_elevation_deviation" @@ -1709,10 +1709,10 @@ wbt_max_upslope_elev_change <- function(dem, output, wd=NULL, verbose_mode=FALSE args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "max_upslope_elev_change" @@ -1746,10 +1746,10 @@ wbt_maximal_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "maximal_curvature" @@ -1783,10 +1783,10 @@ wbt_mean_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, ve if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "mean_curvature" @@ -1812,10 +1812,10 @@ wbt_min_downslope_elev_change <- function(dem, output, wd=NULL, verbose_mode=FAL args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "min_downslope_elev_change" @@ -1849,10 +1849,10 @@ wbt_minimal_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "minimal_curvature" @@ -1890,10 +1890,10 @@ wbt_multidirectional_hillshade <- function(dem, output, altitude=45.0, zfactor=N if (full_mode) { args <- paste(args, "--full_mode") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multidirectional_hillshade" @@ -1941,10 +1941,10 @@ wbt_multiscale_elevation_percentile <- function(dem, out_mag, out_scale, sig_dig if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_elevation_percentile" @@ -1982,10 +1982,10 @@ wbt_multiscale_roughness <- function(dem, out_mag, out_scale, max_scale, min_sca if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_roughness" @@ -2023,10 +2023,10 @@ wbt_multiscale_roughness_signature <- function(dem, points, output, max_scale, m if (!is.null(step)) { args <- paste(args, paste0("--step=", step)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_roughness_signature" @@ -2070,10 +2070,10 @@ wbt_multiscale_std_dev_normals <- function(dem, out_mag, out_scale, min_scale=1, if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_std_dev_normals" @@ -2117,10 +2117,10 @@ wbt_multiscale_std_dev_normals_signature <- function(dem, points, output, min_sc if (!is.null(step_nonlinearity)) { args <- paste(args, paste0("--step_nonlinearity=", step_nonlinearity)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_std_dev_normals_signature" @@ -2154,10 +2154,10 @@ wbt_multiscale_topographic_position_image <- function(local, meso, broad, output if (!is.null(lightness)) { args <- paste(args, paste0("--lightness=", lightness)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "multiscale_topographic_position_image" @@ -2183,10 +2183,10 @@ wbt_num_downslope_neighbours <- function(dem, output, wd=NULL, verbose_mode=FALS args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "num_downslope_neighbours" @@ -2212,10 +2212,10 @@ wbt_num_upslope_neighbours <- function(dem, output, wd=NULL, verbose_mode=FALSE, args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "num_upslope_neighbours" @@ -2247,10 +2247,10 @@ wbt_openness <- function(input, pos_output, neg_output, dist=20, wd=NULL, verbos if (!is.null(dist)) { args <- paste(args, paste0("--dist=", dist)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "openness" @@ -2292,10 +2292,10 @@ wbt_pennock_landform_class <- function(dem, output, slope=3.0, prof=0.1, plan=0. if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "pennock_landform_class" @@ -2329,10 +2329,10 @@ wbt_percent_elev_range <- function(dem, output, filterx=3, filtery=3, wd=NULL, v if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "percent_elev_range" @@ -2366,10 +2366,10 @@ wbt_plan_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, ve if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "plan_curvature" @@ -2397,10 +2397,10 @@ wbt_profile <- function(lines, surface, output, wd=NULL, verbose_mode=FALSE, com args <- paste(args, paste0("--lines=", wbt_file_path(lines))) args <- paste(args, paste0("--surface=", wbt_file_path(surface))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "profile" @@ -2434,10 +2434,10 @@ wbt_profile_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "profile_curvature" @@ -2471,10 +2471,10 @@ wbt_relative_aspect <- function(dem, output, azimuth=0.0, zfactor=NULL, wd=NULL, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "relative_aspect" @@ -2508,10 +2508,10 @@ wbt_relative_topographic_position <- function(dem, output, filterx=11, filtery=1 if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "relative_topographic_position" @@ -2545,10 +2545,10 @@ wbt_remove_off_terrain_objects <- function(dem, output, filter=11, slope=15.0, w if (!is.null(slope)) { args <- paste(args, paste0("--slope=", slope)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "remove_off_terrain_objects" @@ -2582,10 +2582,10 @@ wbt_ring_curvature <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, ver if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ring_curvature" @@ -2619,10 +2619,10 @@ wbt_rotor <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, verbose_mode if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "rotor" @@ -2652,10 +2652,10 @@ wbt_ruggedness_index <- function(dem, output, zfactor=NULL, wd=NULL, verbose_mod if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "ruggedness_index" @@ -2691,10 +2691,10 @@ wbt_sediment_transport_index <- function(sca, slope, output, sca_exponent=0.4, s if (!is.null(slope_exponent)) { args <- paste(args, paste0("--slope_exponent=", slope_exponent)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "sediment_transport_index" @@ -2752,10 +2752,10 @@ wbt_shadow_animation <- function(input, output, palette="atlas", max_dist="", da if (!is.null(label)) { args <- paste(args, paste0("--label=", label)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shadow_animation" @@ -2801,10 +2801,10 @@ wbt_shadow_image <- function(input, output, palette="soft", max_dist="", date="2 if (!is.null(location)) { args <- paste(args, paste0("--location=", location)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shadow_image" @@ -2834,10 +2834,10 @@ wbt_shape_index <- function(dem, output, zfactor=1.0, wd=NULL, verbose_mode=FALS if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "shape_index" @@ -2871,10 +2871,10 @@ wbt_slope <- function(dem, output, zfactor=NULL, units="degrees", wd=NULL, verbo if (!is.null(units)) { args <- paste(args, paste0("--units=", units)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "slope" @@ -2912,10 +2912,10 @@ wbt_slope_vs_aspect_plot <- function(input, output, bin_size=2.0, min_slope=0.1, if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "slope_vs_aspect_plot" @@ -2945,10 +2945,10 @@ wbt_slope_vs_elevation_plot <- function(inputs, output, watershed=NULL, wd=NULL, if (!is.null(watershed)) { args <- paste(args, paste0("--watershed=", watershed)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "slope_vs_elevation_plot" @@ -2986,10 +2986,10 @@ wbt_smooth_vegetation_residual <- function(input, output, max_scale=30, dev_thre if (!is.null(scale_threshold)) { args <- paste(args, paste0("--scale_threshold=", scale_threshold)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "smooth_vegetation_residual" @@ -3019,10 +3019,10 @@ wbt_spherical_std_dev_of_normals <- function(dem, output, filter=11, wd=NULL, ve if (!is.null(filter)) { args <- paste(args, paste0("--filter=", filter)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "spherical_std_dev_of_normals" @@ -3060,10 +3060,10 @@ wbt_standard_deviation_of_slope <- function(input, output, zfactor=NULL, filterx if (!is.null(filtery)) { args <- paste(args, paste0("--filtery=", filtery)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "standard_deviation_of_slope" @@ -3095,10 +3095,10 @@ wbt_stream_power_index <- function(sca, slope, output, exponent=1.0, wd=NULL, ve if (!is.null(exponent)) { args <- paste(args, paste0("--exponent=", exponent)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "stream_power_index" @@ -3124,10 +3124,10 @@ wbt_surface_area_ratio <- function(dem, output, wd=NULL, verbose_mode=FALSE, com args <- "" args <- paste(args, paste0("--dem=", wbt_file_path(dem))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "surface_area_ratio" @@ -3161,10 +3161,10 @@ wbt_tangential_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NU if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "tangential_curvature" @@ -3222,10 +3222,10 @@ wbt_time_in_daylight <- function(dem, output, lat, long, az_fraction=10.0, max_d if (!is.null(end_time)) { args <- paste(args, paste0("--end_time=", end_time)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "time_in_daylight" @@ -3283,10 +3283,10 @@ wbt_topographic_position_animation <- function(input, output, palette="bl_yl_rd" if (dev_max) { args <- paste(args, "--dev_max") } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "topographic_position_animation" @@ -3320,10 +3320,10 @@ wbt_total_curvature <- function(dem, output, log=FALSE, zfactor=NULL, wd=NULL, v if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "total_curvature" @@ -3357,10 +3357,10 @@ wbt_unsphericity <- function(dem, output, log=FALSE, zfactor=1.0, wd=NULL, verbo if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "unsphericity" @@ -3394,10 +3394,10 @@ wbt_vertical_excess_curvature <- function(dem, output, log=FALSE, zfactor=1.0, w if (!is.null(zfactor)) { args <- paste(args, paste0("--zfactor=", zfactor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "vertical_excess_curvature" @@ -3429,10 +3429,10 @@ wbt_viewshed <- function(dem, stations, output, height=2.0, wd=NULL, verbose_mod if (!is.null(height)) { args <- paste(args, paste0("--height=", height)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "viewshed" @@ -3466,10 +3466,10 @@ wbt_visibility_index <- function(dem, output, height=2.0, res_factor=2, wd=NULL, if (!is.null(res_factor)) { args <- paste(args, paste0("--res_factor=", res_factor)) } - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "visibility_index" @@ -3497,10 +3497,10 @@ wbt_wetness_index <- function(sca, slope, output, wd=NULL, verbose_mode=FALSE, c args <- paste(args, paste0("--sca=", wbt_file_path(sca))) args <- paste(args, paste0("--slope=", wbt_file_path(slope))) args <- paste(args, paste0("--output=", wbt_file_path(output))) - if (!is.null(wd)) { + if (!missing(wd)) { args <- paste(args, paste0("--wd=", wd)) } - if (!is.null(compress_rasters)) { + if (!missing(compress_rasters)) { args <- paste(args, paste0("--compress_rasters=", compress_rasters)) } tool_name <- "wetness_index"