Skip to contents

Read default configuration of the package and complete it with eventual user config

Usage

loadConfig(
  sic_path = NULL,
  xml_path = NULL,
  userFile = "config.yml",
  pathDefaultCfg = system.file("config.yml", package = "rsic2")
)

Arguments

sic_path

character, the path to an installation of SIC (see details)

xml_path

character, the path of the XML project file (see details)

userFile

location of the user config YML file

pathDefaultCfg

The location of the default configuration (located in "inst/config.yml" of the package by default)

Value

A configuration as it is returned by config::get. Configuration of RSIC2 as the following structure:

  • sic

    • path: Path of local SIC installation (should be defined by sic_path parameter or in the user config file)

    • edisic: sub-path to EdiSIC program

    • talweg: sub-path to TALWEG program

    • fluvia: sub-path to FLUVIA program

    • sirene: sub-path to SIRENE program

    • export: sub-path to SicExport program

    • fortran:

      • prms:

        • INTERF: default INTERF parameter injected in command line arguments of TALWEG, FLUVIA, SIRENE

  • project

    • path: Path to the XML project file (should be defined by xml_path parameter or in the user config file)

    • stricklers: A vector of 2 numeric values representing respectively the default minor and medium bed Strickler coefficients to apply with sic_import_reaches

Details

The path to SIC and to the XML project file can be defined in the user XML file by defining the appropriate items:

sic:

  path: Path/To/SIC/installation

project:

  path: Path/To/Xml/Project/File.xml

Moreover, the sic_path can be defined with the environment variable "SICPATH". This setting is a default which is overwritten by the path defined in the user YAML file, which is also overwritten by the one define by the sic_path argument.

Examples

library(rsic2)
sic_path <- tempdir(check = TRUE)
xml_path <- R.utils::tmpfile()
cfg <- loadConfig(sic_path, xml_path)
str(cfg)
#> List of 2
#>  $ sic    :List of 7
#>   ..$ fortran:List of 1
#>   .. ..$ prms:List of 1
#>   .. .. ..$ INTERF: chr "0"
#>   ..$ path   : chr "C:\\Users\\DAVID~1.DOR\\AppData\\Local\\Temp\\Rtmp80xC7T"
#>   ..$ edisic : chr "exe/EdiSIC.exe"
#>   ..$ talweg : chr "exe/TALWEG.exe"
#>   ..$ fluvia : chr "exe/FLUVIA.exe"
#>   ..$ sirene : chr "exe/SIRENE.exe"
#>   ..$ export : chr "exe/SicExport.exe"
#>  $ project:List of 2
#>   ..$ path      : chr "C:\\Users\\DAVID~1.DOR\\AppData\\Local\\Temp\\Rtmp80xC7T\\file3ca062052d47"
#>   .. ..- attr(*, "gc")=<environment: 0x000000003712aa38> 
#>   ..$ stricklers: int [1:2] 40 40
#>  - attr(*, "config")= chr "default"
#>  - attr(*, "file")= chr "C:\\Users\\david.dorchies\\AppData\\Local\\Temp\\RtmpsD6aZ8\\temp_libpath257077564f2a\\rsic2\\config.yml"