diff --git a/.Rbuildignore b/.Rbuildignore index 5b259d4ec12a40305440fa830e7bec76157b7ce7..8042825fb18bc137152578fe90fc6104e2722b41 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,3 @@ ^.*\.Rproj$ ^\.Rproj\.user$ -test.R \ No newline at end of file +test* \ No newline at end of file diff --git a/.gitignore b/.gitignore index e18bfc44b99381bddba4a3239f2638de5fe3f749..a84040b33ad906c0efe4d0cd4634f42e8f4aed39 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,4 @@ vignettes/*.pdf # Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html rsconnect/ .Rproj.user -test.R \ No newline at end of file +test* \ No newline at end of file diff --git a/NAMESPACE b/NAMESPACE index c8e27814bb092d073fb08423dc4c96652751bf2c..4543aa7f02ef5b994e00b311d51d753c09dc4bcc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +export(add_kill_op) export(get_hru_id_by_attribute) export(plot_climate_annual) export(plot_hru_pw_day) diff --git a/R/helper.R b/R/helper.R index e873583e08febbb7d6d6453dce351b77f9db732f..7bb59233ccce6db7c13650f302c482941395992b 100644 --- a/R/helper.R +++ b/R/helper.R @@ -14,7 +14,6 @@ add_kill_op <- function(project_path){ mgt_sch <- read_lines(paste0(project_path,'/management.sch'), lazy = FALSE) - write_lines(mgt_sch, paste0(project_path,'/management_bak.sch')) l <- 0 while(length(grep("hvkl", mgt_sch)) != 0){ i <- grep("hvkl", mgt_sch)[1] @@ -26,8 +25,9 @@ add_kill_op <- function(project_path){ l <- l+1 } if(l > 0){ + file.copy(paste0(project_path,'/management.sch'), paste0(project_path,'/management_bak.sch')) write_lines(mgt_sch, paste0(project_path,'/management.sch')) - return(paste0(l, " lines were updated in 'management.sch'. Original file is backed up in 'management_bak.sch'.")) + return(paste0(l, " lines were updated (`hvkl` changed to `harv`) and same number added (with `kill` operations) in 'management.sch'. Original file is backed up in 'management_bak.sch'.")) } else { return("No `hvkl` operations exist in 'management.sch'. File was not changed.") } diff --git a/man/add_kill_op.Rd b/man/add_kill_op.Rd new file mode 100644 index 0000000000000000000000000000000000000000..3ef0d5788b6c9285d211f36ce9cc47675971eb88 --- /dev/null +++ b/man/add_kill_op.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helper.R +\name{add_kill_op} +\alias{add_kill_op} +\title{Replace hvkl operations with harv + kill} +\usage{ +add_kill_op(project_path) +} +\arguments{ +\item{project_path}{Character string, path to the SWAT+ project folder +(i.e. TxtInOut).} +} +\value{ +updated management.sch file +} +\description{ +Replace hvkl operations with harv + kill +} +\examples{ +\dontrun{ +add_kill_op('path_to_your_model') +} +} diff --git a/man/insert_line_at.Rd b/man/insert_line_at.Rd new file mode 100644 index 0000000000000000000000000000000000000000..10303c5a6b6fbde3acf9698b587b0a65c56f1cfb --- /dev/null +++ b/man/insert_line_at.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helper.R +\name{insert_line_at} +\alias{insert_line_at} +\title{Insert line into character with multiple lines} +\usage{ +insert_line_at(dat, txt, insert_after) +} +\arguments{ +\item{dat}{character with multiple lines} + +\item{txt}{character line to be inserted} + +\item{insert_after}{numeric for line number after, which to insert txt} +} +\value{ +character with multiple lines with inserted new lines +} +\description{ +Insert line into character with multiple lines +} +\keyword{internal}