Commit 9957de4e authored by Dorchies David's avatar Dorchies David
Browse files

fix: breaking changes in airGR 1.6.12.9001

- OutputsModel$Param is now OutputsModel$RunOptions$Param
- OutputsModel$WarmUpQsim is now OutputsModel$RunOptions$WarmUpQsim

Refs #62
parent a7288656
Pipeline #28590 passed with stage
in 6 minutes and 29 seconds
Package: airGRiwrm
Title: 'airGR' Integrated Water Resource Management
Version: 0.5.0.9000
Version: 0.5.0.9001
Authors@R: c(
person("David", "Dorchies", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6595-7984"), email = "david.dorchies@inrae.fr"),
person("Olivier", "Delaigue", role = c("ctb"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"),
......@@ -17,7 +17,7 @@ Imports:
utils,
grDevices,
graphics,
airGR (>= 1.6.12.9000)
airGR (>= 1.6.12.9001)
Suggests:
knitr,
rmarkdown,
......@@ -31,4 +31,4 @@ BugReports: https://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/
Depends:
R (>= 2.10)
Remotes:
url::https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/archive/dev/airgr-dev.zip
url::https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/archive/137b-fix-extractoutputsmodel-function/airgr-137b-fix-extractoutputsmodel-function.zip
......@@ -87,7 +87,7 @@ getInputsCrit_Lavenne <- function(id, OutputsModel, InputsCrit) {
AprioriId <- attr(InputsCrit[[id]], "AprioriId")
AprCelerity <- attr(InputsCrit[[id]], "AprCelerity")
Lavenne_FUN <- attr(InputsCrit[[id]], "Lavenne_FUN")
AprParamR <- OutputsModel[[AprioriId]]$Param
AprParamR <- OutputsModel[[AprioriId]]$RunOptions$Param
if(!inherits(OutputsModel[[AprioriId]], "SD")) {
# Add default velocity parameter for a priori upstream catchment
AprParamR <- c(AprCelerity, AprParamR)
......
......@@ -15,7 +15,7 @@ RunModel.InputsModel <- function(x, RunOptions, Param, FUN_MOD = NULL, ...) {
OutputsModel$Qsim_m3 <- OutputsModel$Qsim * sum(x$BasinAreas) * 1e3
}
if ("WarmUpQsim" %in% RunOptions$Outputs_Sim) {
OutputsModel$WarmUpQsim_m3 <- OutputsModel$WarmUpQsim * sum(x$BasinAreas) * 1e3
OutputsModel$RunOptions$WarmUpQsim_m3 <- OutputsModel$RunOptions$WarmUpQsim * sum(x$BasinAreas) * 1e3
}
return(OutputsModel)
}
......@@ -14,8 +14,8 @@ UpdateQsimUpstream <- function(InputsModel, Runoptions, OutputsModel) {
iQ <- which(InputsModel$UpstreamIsRunoff)
for(i in iQ) {
InputsModel$Qupstream[Runoptions$IndPeriod_Run, i] <- OutputsModel[[InputsModel$UpstreamNodes[i]]]$Qsim_m3
if (!is.null(OutputsModel[[InputsModel$UpstreamNodes[i]]]$WarmUpQsim_m3)) {
InputsModel$Qupstream[Runoptions$IndPeriod_WarmUp, i] <- OutputsModel[[InputsModel$UpstreamNodes[i]]]$WarmUpQsim_m3
if (!is.null(OutputsModel[[InputsModel$UpstreamNodes[i]]]$RunOptions$WarmUpQsim_m3)) {
InputsModel$Qupstream[Runoptions$IndPeriod_WarmUp, i] <- OutputsModel[[InputsModel$UpstreamNodes[i]]]$RunOptions$WarmUpQsim_m3
}
}
return(InputsModel)
......
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