Commit 078e10a4 authored by Dorchies David's avatar Dorchies David
Browse files

feat: move creation of FortranOutputs from RunModel to RunOptions

- add item `FortranOutputs` in `RunOptions`
- Create a data-raw script (See https://r-pkgs.org/data.html#data-data) for generation of necessary data for vignettes
- Update the file inst/vignettesData/vignetteParamOptimCaramel.rda

Refs #129
parent f627dd32
......@@ -9,3 +9,4 @@
^\.vscode$
^Rplots\.pdf$
^ci$
^data-raw$
......@@ -24,6 +24,11 @@ CreateRunOptions <- function(FUN_MOD, InputsModel,
ObjectClass <- FeatFUN_MOD$Class
TimeStepMean <- FeatFUN_MOD$TimeStepMean
## Model output variable list
ModelHydro <- gsub("CemaNeige", "", FeatFUN_MOD$CodeMod)
FortranOutputs <- .FortranOutputs(GR = ModelHydro,
isCN = substr(FeatFUN_MOD$CodeMod, 1, 9) == "CemaNeige")
## manage class
if (IsIntStore) {
ObjectClass <- c(ObjectClass, "interception")
......@@ -473,7 +478,8 @@ CreateRunOptions <- function(FUN_MOD, InputsModel,
IniStates = IniStates,
IniResLevels = IniResLevels,
Outputs_Cal = Outputs_Cal,
Outputs_Sim = Outputs_Sim)
Outputs_Sim = Outputs_Sim,
FortranOutputs = FortranOutputs)
if ("CemaNeige" %in% ObjectClass) {
RunOptions <- c(RunOptions, list(MeanAnSolidPrecip = MeanAnSolidPrecip))
......
## code to prepare datasets used in vignettes
library(airGR)
source("tests/testthat/helper_vignettes.R")
# V02.1_param_optim
RunVignetteChunks("V02.1_param_optim")
save(resGLOB, resPORT,
file = "inst/vignettesData/vignetteParamOptim.rda",
version = 2)
save(algo, Ind_Run, InputsCrit_inv, InputsModel, MOptimGR4J, optMO, RunOptions,
file = "inst/vignettesData/vignetteParamOptimCaramel.rda",
version = 2)
# V02.2_param_mcmc
RunVignetteChunks("V02.2_param_mcmc")
save(gelRub, multDRAM,
file = "inst/vignettesData/vignetteParamMCMC.rda",
version = 2)
# V04_cemaneige_hysteresis
RunVignetteChunks("V04_cemaneige_hysteresis")
save(OutputsCrit_Cal, OutputsCrit_Cal_NoHyst, OutputsCrit_Val, OutputsCrit_Val_NoHyst,
file = "inst/vignettesData/vignetteParamMCMC.rda",
version = 2)
......@@ -73,6 +73,9 @@ RunVignetteChunks <- function(vignette,
if(file.exists(sprintf("../../vignettes/%s.Rmd", vignette))) {
# testthat context in development environnement
RunRmdChunks(sprintf("../../vignettes/%s.Rmd", vignette), tmpFolder, force.eval)
} else if(file.exists(sprintf("vignettes/%s.Rmd", vignette))) {
# context in direct run in development environnement
RunRmdChunks(sprintf("vignettes/%s.Rmd", vignette), tmpFolder, force.eval)
} else {
# R CMD check context in package environnement
RunRmdChunks(system.file(sprintf("doc/%s.Rmd", vignette), package = "airGR"), tmpFolder, force.eval)
......
Markdown is supported
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