Skip to content

Commit

Permalink
disable non-ASCII paths
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarraro committed Apr 24, 2024
1 parent 9b763b5 commit 2e2542e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: traudem
Title: Use TauDEM
Version: 1.0.2
Version: 1.0.3
Authors@R: c(
person("Luca", "Carraro", , "[email protected]", role = c("cre", "aut")),
person("University of Zurich", role = c("cph", "fnd")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# traudem 1.0.3

* An error is thrown if path files containing non-ASCII characters are used.

# traudem 1.0.2

* Updated documentation on workflow to install `traudem` in macOS and Linux.
Expand Down
5 changes: 5 additions & 0 deletions R/aread8.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ 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: 5 additions & 0 deletions R/d8flowdir.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ 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: 6 additions & 0 deletions R/moveoutletstostrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ 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: 5 additions & 0 deletions R/pitremove.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ 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/threshold.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ 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 2e2542e

Please sign in to comment.