Commit 8958631d authored by Delaigue Olivier's avatar Delaigue Olivier Committed by Dorchies David

v1.6.1.0 NEW: RunModel function now take into account semi-distribution #34

parent b67e59aa
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.0.2
Version: 1.6.1.0
Date: 2020-04-05
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -2,7 +2,7 @@
### 1.6.0.2 Release Notes (2020-04-05)
### 1.6.1.0 Release Notes (2020-04-05)
#### New features
......
RunModel <- function(InputsModel, RunOptions, Param, FUN_MOD) {
RunModel <- function (InputsModel, RunOptions, Param, FUN_MOD) {
FUN_MOD <- match.fun(FUN_MOD)
return(FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param))
if ("SD" %in% class(InputsModel)) {
Outputs_down <- FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions,
Param = Param[-length(Param)])
Outputs_down$Qdown <- Outputs_down$Qsim
if ("daily" %in% class(InputsModel)){
TimeStep <- 60 * 60 * 24
}
if ("hourly" %in% class(InputsModel)){
TimeStep <- 60 * 60
}
surf_tot <- sum(InputsModel$S_basin)
Outputs_down$Qsim <- Outputs_down$Qdown * InputsModel$S_basin[length(InputsModel$S_basin)] / surf_tot +
1000 / tail(Param, 1) / TimeStep *
InputsModel$Q_upstr %*% (InputsModel$L_hyd[1,] * InputsModel$S_basin[1:length(InputsModel$L_hyd)])
} else {
Outputs_down <- FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param)
}
return(Outputs_down)
}
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