Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • R Rsic2
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

En prévision de l'arrivée de la forge institutionnelle INRAE, nous vous invitons à créer vos nouveaux projets sur la forge MIA.

  • SIC2SIC2
  • Rsic2
  • Merge requests
  • !1
An error occurred while fetching the assigned milestone of the selected merge_request.

Resolve "Functions to run Talweg, Fluvia, Sirene"

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Dorchies David requested to merge 2-functions-to-run-talweg-fluvia-sirene into main 3 years ago
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 8

Closes #2 (closed)

Edited 3 years ago by Dorchies David
Compare
  • main (base)

and
  • latest version
    643f7472
    2 commits, 3 years ago

8 files
+ 4462
− 1

    Preferences

    File browser
    Compare changes

Some changes are not shown

For a faster browsing experience, some files are collapsed by default.

R/loadConfig.R
+ 4
− 1
  • View file @ 643f7472

  • Edit in single-file editor

  • Open in Web IDE


@@ -30,7 +30,10 @@
@@ -30,7 +30,10 @@
#' str(cfg)
#' str(cfg)
loadConfig <- function(sic_path = NULL, xml_path = NULL, userFile = "config.yml", pathDefaultCfg = system.file("config.yml", package = "rsic2")) {
loadConfig <- function(sic_path = NULL, xml_path = NULL, userFile = "config.yml", pathDefaultCfg = system.file("config.yml", package = "rsic2")) {
cfg <- config::get(file = pathDefaultCfg)
cfg <- config::get(file = pathDefaultCfg)
if (file.exists(userFile)) {cfg = config::merge(cfg,config::get(file = userFile))}
if (file.exists(userFile)) {
 
message("Reading user configuration from ", userFile)
 
cfg = config::merge(cfg,config::get(file = userFile))
 
}
if (!is.null(sic_path)) cfg$sic$path <- sic_path
if (!is.null(sic_path)) cfg$sic$path <- sic_path
if (!is.null(xml_path)) cfg$project$path <- xml_path
if (!is.null(xml_path)) cfg$project$path <- xml_path
if (!dir.exists(cfg$sic$path)) {
if (!dir.exists(cfg$sic$path)) {
R/sic_run_fortran.R 0 → 100644
+ 32
− 0
  • View file @ 643f7472

  • Edit in single-file editor

  • Open in Web IDE

 
#' Run Talweg, Fluvia or Sirene
 
#'
 
#' @param prog [character], the program to run. Should be one of "talweg"
 
#' @param params [list] or [character], see details
 
#' @param cfg
 
#'
 
#' @details If argument `params` is a [list], arguments are injected in the command line by taking the items of the list with the conversion
 
#' `[key]=[value]`. If argument `params` is a [character]
 
#'
 
#' @return
 
#' @export
 
#'
 
#' @examples
 
#' \dontrun{
 
#' # Run steady simulation for the scenario #1
 
#' params <- list(SCE=1)
 
#' sic_run_fortran("fluvia", params)
 
#'}
 
sic_run_fortran <- function(prog, params, cfg = loadConfig()) {
 
if (is.list(params)) params <- convert_sic_params(params, cfg)
 
shell(
 
shQuote(
 
paste(
 
file.path(cfg$sic$path, cfg$sic[[prog]]),
 
shQuote(cfg$project$path, type = "cmd"),
 
params
 
),
 
type = "cmd2"),
 
wait = T,
 
translate = T
 
)
 
}
inst/sic_project_test1.xml 0 → 100644
+ 4376
− 0
  • View file @ 643f7472

  • Edit in single-file editor

  • Open in Web IDE

Files with large changes are collapsed by default.

man/sic_run_fortran.Rd 0 → 100644
+ 32
− 0
  • View file @ 643f7472

  • Edit in single-file editor

  • Open in Web IDE

 
% Generated by roxygen2: do not edit by hand
 
% Please edit documentation in R/sic_run_fortran.R
 
\name{sic_run_fortran}
 
\alias{sic_run_fortran}
 
\title{Run Talweg, Fluvia or Sirene}
 
\usage{
 
sic_run_fortran(prog, params, cfg = loadConfig())
 
}
 
\arguments{
 
\item{prog}{\link{character}, the program to run. Should be one of "talweg"}
 
 
\item{params}{\link{list} or \link{character}, see details}
 
 
\item{cfg}{}
 
}
 
\value{
 
 
}
 
\description{
 
Run Talweg, Fluvia or Sirene
 
}
 
\details{
 
If argument \code{params} is a \link{list}, arguments are injected in the command line by taking the items of the list with the conversion
 
\verb{[key]=[value]}. If argument \code{params} is a \link{character}
 
}
 
\examples{
 
\dontrun{
 
# Run steady simulation for the scenario #1
 
params <- list(SCE=1)
 
sic_run_fortran("fluvia", params)
 
}
 
}
tests/testthat/helper-sic_local_config.R 0 → 100644
+ 7
− 0
  • View file @ 643f7472

  • Edit in single-file editor

  • Open in Web IDE

 
# Set local configuration for SIC tests
 
 
xml_path <- tempfile("sic_project", fileext = ".xml")
 
file.copy(system.file("sic_project_test1.xml", package = "rsic2"),
 
xml_path,
 
overwrite = TRUE)
 
cfg <- loadConfig(xml_path = xml_path)
Assignee
Dorchies David's avatar
Dorchies David
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 Participants
Reference:
Source branch: 2-functions-to-run-talweg-fluvia-sirene

Menu

Explore Projects Groups Topics Snippets