This is how you would use traudem to launch TauDEM's PitRemove:
library(traudem) test_dir <- withr::local_tempdir() fs::file_copy( system.file("test-data", "DEM.tif", package = "traudem"), file.path(test_dir, "DEM.tif") ) output <- taudem_pitremove(file.path(test_dir, "DEM.tif")) output
We ran the example above in a temporary directory that withr
automatically deletes.
If you want to automatically get rid of some of the intermediary files created by TauDEM in one of your pipelines, you might be interested in withr::local_tempfile()
.
If you wanted to run this same code without seeing the messages from TauDEM, you can either use the quiet
argument:
test_dir <- withr::local_tempdir() fs::file_copy( system.file("test-data", "DEM.tif", package = "traudem"), file.path(test_dir, "DEM.tif") ) output <- taudem_pitremove(file.path(test_dir, "DEM.tif"), quiet = TRUE) output
Or set the traudem.quiet
option (options(traudem.quiet = TRUE)
or for just the session, withr::local_options(traudem.quiet = TRUE)
):
withr::local_options(traudem.quiet = TRUE) test_dir <- withr::local_tempdir() fs::file_copy( system.file("test-data", "DEM.tif", package = "traudem"), file.path(test_dir, "DEM.tif") ) output <- taudem_pitremove(file.path(test_dir, "DEM.tif")) output
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.