Skip to content

Commit

Permalink
disable non-ASCII paths in taudem_exec
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarraro committed Apr 24, 2024
1 parent 2e2542e commit f3fc067
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 26 deletions.
5 changes: 0 additions & 5 deletions R/aread8.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ taudem_aread8 <- function(input_d8flowdir_grid,
rlang::abort("outlet_layer_name and outlet_layer_number must not both be specified.")
}

if (grepl("[^ -~]", input_d8flowdir_grid) | grepl("[^ -~]", output_contributing_area_grid)){
rlang::abort("The path file and/or the working directory contain(s) non-ASCII
characters, which are not supported by MPI.")
}

args <- c(
"-p", input_d8flowdir_grid,
"-ad8", output_contributing_area_grid
Expand Down
5 changes: 0 additions & 5 deletions R/d8flowdir.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ taudem_d8flowdir <- function(input_elevation_grid,
output_d8slopes_grid <- sprintf("%s.tif", output_d8slopes_grid_file)
}

if (grepl("[^ -~]", input_elevation_grid) | grepl("[^ -~]", output_d8flowdir_grid)){
rlang::abort("The path file and/or the working directory contain(s) non-ASCII
characters, which are not supported by MPI.")
}

args <- c(
"-fel", input_elevation_grid,
"-p", output_d8flowdir_grid,
Expand Down
6 changes: 0 additions & 6 deletions R/moveoutletstostrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ taudem_moveoutletstostream <- function(input_d8flowdir_grid,
"moveoutletstostrm"
}

if (grepl("[^ -~]", input_d8flowdir_grid) | grepl("[^ -~]", input_stream_raster_grid) |
grepl("[^ -~]",output_moved_outlets_file)){
rlang::abort("The path file and/or the working directory contain(s) non-ASCII
characters, which are not supported by MPI.")
}

args <- c(
"-p", input_d8flowdir_grid,
"-src", input_stream_raster_grid,
Expand Down
5 changes: 0 additions & 5 deletions R/pitremove.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ taudem_pitremove <- function(input_elevation_grid,
rlang::abort(sprintf("Can't find file %s (depmask)", depmask))
}

if (grepl("[^ -~]", input_elevation_grid) | grepl("[^ -~]", output_elevation_grid)){
rlang::abort("The path file and/or the working directory contain(s) non-ASCII
characters, which are not supported by MPI.")
}

args <- c(
"-z", input_elevation_grid,
"-fel", output_elevation_grid
Expand Down
5 changes: 5 additions & 0 deletions R/taudem-exec.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ taudem_exec <- function(program, args, ..., n_processes = getOption("traudem.n_p
}
register_taudem()

if (grepl("[^ -~]", getwd())){
rlang::abort("The working directory contain(s) non-ASCII characters,
which are not supported by MPI.")
}

if (!is.null(n_processes)) {
cmd <- "mpiexec"
args <- c("-n", n_processes, program, args)
Expand Down
5 changes: 0 additions & 5 deletions R/threshold.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ taudem_threshold <- function(input_area_grid,
rlang::abort(sprintf("Can't find file %s (mask_file)", mask_file))
}

if (grepl("[^ -~]", input_area_grid) | grepl("[^ -~]", output_stream_raster_grid)){
rlang::abort("The path file and/or the working directory contain(s) non-ASCII
characters, which are not supported by MPI.")
}

args <- c(
"-ssa", input_area_grid,
"-src", output_stream_raster_grid,
Expand Down

0 comments on commit f3fc067

Please sign in to comment.