Commit 2ff9e331 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.1.3 CLEAN: minor code revisions in RunModel #34

parent 3921249e
No related merge requests found
Showing with 6 additions and 6 deletions
+6 -6
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.1.2
Version: 1.6.1.3
Date: 2020-04-05
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -4,7 +4,7 @@
### 1.6.1.2 Release Notes (2020-04-05)
### 1.6.1.3 Release Notes (2020-04-05)
#### New features
......
RunModel <- function (InputsModel, RunOptions, Param, FUN_MOD) {
FUN_MOD <- match.fun(FUN_MOD)
if ("SD" %in% class(InputsModel)) {
if (inherits(InputsModel, "SD")) {
Outputs_down <- FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions,
Param = Param[-length(Param)])
Outputs_down$Qdown <- Outputs_down$Qsim
if ("daily" %in% class(InputsModel)) {
if (inherits(InputsModel, "daily")) {
TimeStep <- 60 * 60 * 24
}
if ("hourly" %in% class(InputsModel)) {
if (inherits(InputsModel, "hourly")) {
TimeStep <- 60 * 60
}
surf_tot <- sum(InputsModel$BasinAreas)
Outputs_down$Qsim <- Outputs_down$Qdown * InputsModel$BasinAreas[length(InputsModel$BasinAreas)] / surf_tot +
1000 / tail(Param, 1) / TimeStep *
1000 / Param[-length(Param)] / TimeStep *
InputsModel$QobsUpstr %*% (InputsModel$LengthHydro[1, ] * InputsModel$BasinAreas[1:length(InputsModel$LengthHydro)])
} else {
Outputs_down <- FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param)
......
Supports Markdown
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