Commit e91aab2f authored by Dorchies David's avatar Dorchies David
Browse files

ci: add dontrun to examples running SIC

1 merge request!6Resolve "Read result simulation in sections from a binary result files"
Pipeline #33957 passed with stage
in 2 minutes and 16 seconds
Showing with 25 additions and 5 deletions
+25 -5
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
#' @export #' @export
#' #'
#' @examples #' @examples
#' \dontrun{
#' cfg <- cfg_tmp_project() #' cfg <- cfg_tmp_project()
#' cfg$project$xml_path #' cfg$project$xml_path
#' }
#' #'
cfg_tmp_project <- function(xml_path = system.file("sic_project_test1.xml", package = "rsic2"), cfg = loadConfig(xml_path = xml_path)) { cfg_tmp_project <- function(xml_path = system.file("sic_project_test1.xml", package = "rsic2"), cfg = loadConfig(xml_path = xml_path)) {
cfg$project$path <- tempfile("sic_project", fileext = ".xml") cfg$project$path <- tempfile("sic_project", fileext = ".xml")
......
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
#' @export #' @export
#' #'
#' @examples #' @examples
#' \dontrun{
#' cfg <- cfg_tmp_project() #' cfg <- cfg_tmp_project()
#' convert_sic_params(list(SCE = 1, VAR = 1), cfg = cfg) #' convert_sic_params(list(SCE = 1, VAR = 1), cfg = cfg)
#' #' }
convert_sic_params <- function(params, cfg = loadConfig()) { convert_sic_params <- function(params, cfg = loadConfig()) {
if (!"INTERF" %in% names(params)) { if (!"INTERF" %in% names(params)) {
params <- c(list(INTERF = cfg$sic$fortran$prms$INTERF), params) params <- c(list(INTERF = cfg$sic$fortran$prms$INTERF), params)
......
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
#' @import magrittr #' @import magrittr
#' #'
#' @examples #' @examples
#' \dontrun{
#' cfg <- cfg_tmp_project() #' cfg <- cfg_tmp_project()
#' sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg) #' sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg)
#' get_result(cfg, 1, filters = c("bf==4", "var=='Z'")) #' get_result(cfg, 1, filters = c("bf==4", "var=='Z'"))
#' }
get_result <- function(cfg, get_result <- function(cfg,
scenario, scenario,
variant = 0, variant = 0,
...@@ -51,10 +53,12 @@ get_result <- function(cfg, ...@@ -51,10 +53,12 @@ get_result <- function(cfg,
#' @export #' @export
#' #'
#' @examples #' @examples
#' \dontrun{
#' cfg <- cfg_tmp_project() #' cfg <- cfg_tmp_project()
#' sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg) #' sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg)
#' m <- read_bin_result_matrix(cfg, 1) #' m <- read_bin_result_matrix(cfg, 1)
#' str(m) #' str(m)
#' }
read_bin_result_matrix <- function(cfg, scenario, variant = 0) { read_bin_result_matrix <- function(cfg, scenario, variant = 0) {
file <- paste0( file <- paste0(
paste(gsub("\\.xml", "", cfg$project$path), paste(gsub("\\.xml", "", cfg$project$path),
...@@ -102,10 +106,12 @@ read_bin_result_matrix <- function(cfg, scenario, variant = 0) { ...@@ -102,10 +106,12 @@ read_bin_result_matrix <- function(cfg, scenario, variant = 0) {
#' @import magrittr #' @import magrittr
#' #'
#' @examples #' @examples
#' \dontrun{
#' cfg <- cfg_tmp_project() #' cfg <- cfg_tmp_project()
#' sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg) #' sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg)
#' df <- get_result_tree(cfg, 1) #' df <- get_result_tree(cfg, 1)
#' head(df) #' head(df)
#' }
get_result_tree <- function(cfg, scenario, variant = 0) { get_result_tree <- function(cfg, scenario, variant = 0) {
x <- read_xml(cfg$project$path) x <- read_xml(cfg$project$path)
objs = c("Ouvrage", "Section", "Prise", "Noeud") objs = c("Ouvrage", "Section", "Prise", "Noeud")
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
#' @examples #' @examples
#' \dontrun{ #' \dontrun{
#' # Run steady simulation for the scenario #1 #' # Run steady simulation for the scenario #1
#' cfg <- cfg_tmp_project()
#' params <- list(SCE=1) #' params <- list(SCE=1)
#' sic_run_fortran("fluvia", params) #' sic_run_fortran("fluvia", params, cfg = cfg)
#'} #'}
sic_run_fortran <- function(prog, params = list(), cfg = loadConfig()) { sic_run_fortran <- function(prog, params = list(), cfg = loadConfig()) {
if (is.list(params)) params <- convert_sic_params(params, cfg) if (is.list(params)) params <- convert_sic_params(params, cfg)
......
...@@ -21,7 +21,9 @@ The updated configuration with the temporary project directory ...@@ -21,7 +21,9 @@ The updated configuration with the temporary project directory
Set a configuration with a temporary project directory Set a configuration with a temporary project directory
} }
\examples{ \examples{
\dontrun{
cfg <- cfg_tmp_project() cfg <- cfg_tmp_project()
cfg$project$xml_path cfg$project$xml_path
}
} }
...@@ -21,7 +21,8 @@ This function is called by \link{sic_run_fortran} to convert list of parameters ...@@ -21,7 +21,8 @@ This function is called by \link{sic_run_fortran} to convert list of parameters
The parameter \code{INTERF} is set to 0 (zero) by default. The parameter \code{INTERF} is set to 0 (zero) by default.
} }
\examples{ \examples{
\dontrun{
cfg <- cfg_tmp_project() cfg <- cfg_tmp_project()
convert_sic_params(list(SCE = 1, VAR = 1), cfg = cfg) convert_sic_params(list(SCE = 1, VAR = 1), cfg = cfg)
}
} }
...@@ -30,7 +30,9 @@ get_result( ...@@ -30,7 +30,9 @@ get_result(
Get a selection of variables from a simulation result Get a selection of variables from a simulation result
} }
\examples{ \examples{
\dontrun{
cfg <- cfg_tmp_project() cfg <- cfg_tmp_project()
sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg) sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg)
get_result(cfg, 1, filters = c("bf==4", "var=='Z'")) get_result(cfg, 1, filters = c("bf==4", "var=='Z'"))
} }
}
...@@ -25,8 +25,10 @@ a \link{data.frame} with following columns: ...@@ -25,8 +25,10 @@ a \link{data.frame} with following columns:
Get correspondence between network object and columns in result binary file Get correspondence between network object and columns in result binary file
} }
\examples{ \examples{
\dontrun{
cfg <- cfg_tmp_project() cfg <- cfg_tmp_project()
sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg) sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg)
df <- get_result_tree(cfg, 1) df <- get_result_tree(cfg, 1)
head(df) head(df)
} }
}
...@@ -20,8 +20,10 @@ read_bin_result_matrix(cfg, scenario, variant = 0) ...@@ -20,8 +20,10 @@ read_bin_result_matrix(cfg, scenario, variant = 0)
Read matrix of SIC simulation result file Read matrix of SIC simulation result file
} }
\examples{ \examples{
\dontrun{
cfg <- cfg_tmp_project() cfg <- cfg_tmp_project()
sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg) sic_run_fortran("fluvia", list(SCE = 1), cfg = cfg)
m <- read_bin_result_matrix(cfg, 1) m <- read_bin_result_matrix(cfg, 1)
str(m) str(m)
} }
}
...@@ -44,7 +44,7 @@ maj_reach <- dem_to_reach_txt(dem, node_coords, space_step, section_width, major ...@@ -44,7 +44,7 @@ maj_reach <- dem_to_reach_txt(dem, node_coords, space_step, section_width, major
reach <- merge_reaches(min_reach, maj_reach) reach <- merge_reaches(min_reach, maj_reach)
reaches <- split_reach(reach, seq(0, 10000, 5000)) reaches <- split_reach(reach, seq(0, 10000, 5000))
\donrun{ \dontrun{
# Import with EdiSic # Import with EdiSic
cfg <- cfg_tmp_project() cfg <- cfg_tmp_project()
sic_import_reaches(reaches, cfg = cfg) sic_import_reaches(reaches, cfg = cfg)
......
...@@ -26,7 +26,8 @@ If argument \code{params} is a \link{list}, arguments are injected in the comman ...@@ -26,7 +26,8 @@ If argument \code{params} is a \link{list}, arguments are injected in the comman
\examples{ \examples{
\dontrun{ \dontrun{
# Run steady simulation for the scenario #1 # Run steady simulation for the scenario #1
cfg <- cfg_tmp_project()
params <- list(SCE=1) params <- list(SCE=1)
sic_run_fortran("fluvia", params) sic_run_fortran("fluvia", params, cfg = cfg)
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment