Commit 61d9a74a authored by Delaigue Olivier's avatar Delaigue Olivier

v1.6.1.8 fix: the formula used in RunModel was wrong when SD is used #34

parent 88363e7e
Pipeline #12822 passed with stages
in 11 minutes and 9 seconds
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.1.7
Version: 1.6.1.8
Date: 2020-04-07
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -2,7 +2,7 @@
### 1.6.1.7 Release Notes (2020-04-07)
### 1.6.1.8 Release Notes (2020-04-07)
#### New features
......
......@@ -15,11 +15,18 @@ RunModel <- function (InputsModel, RunOptions, Param, FUN_MOD) {
PT <- InputsModel$LengthHydro[1, ] * 1000 / Param[length(Param)] / TimeStep
HUTRANS <- rbind(1 - (PT - floor(PT)), PT - floor(PT))
OutputsModelDown$Qsim <- OutputsModelDown$QsimDown * InputsModel$BasinAreas[length(InputsModel$BasinAreas)] / AreaTot +
InputsModel$QobsUpstr[(1 + floor(PT)) : length(OutputsModelDown$QsimDown), ] %*% HUTRANS[1, ] *
InputsModel$BasinAreas[1:length(InputsModel$LengthHydro)] / AreaTot +
InputsModel$QobsUpstr[(2 + floor(PT)) : length(OutputsModelDown$QsimDown), ] %*% HUTRANS[2, ] *
InputsModel$BasinAreas[1:length(InputsModel$LengthHydro)] / AreaTot
nb_up_basins <- length(InputsModel$LengthHydro)
length_ts <- length(OutputsModelDown$QsimDown)
OutputsModelDown$Qsim <- OutputsModelDown$QsimDown * InputsModel$BasinAreas[length(InputsModel$BasinAreas)] / AreaTot
for (upstream_basin in 1:nb_up_basins) {
OutputsModelDown$Qsim <- OutputsModelDown$Qsim +
c(rep(0, floor(PT[upstream_basin])),
InputsModel$QobsUpstr[(1 + floor(PT[upstream_basin])) : length_ts, upstream_basin]) *
HUTRANS[1, upstream_basin] * InputsModel$BasinAreas[upstream_basin] / AreaTot +
c(rep(0, floor(PT[upstream_basin] + 1)),
InputsModel$QobsUpstr[(2 + floor(PT[upstream_basin])) : length_ts, upstream_basin]) *
HUTRANS[2, upstream_basin] * InputsModel$BasinAreas[upstream_basin] / AreaTot
}
} else {
OutputsModelDown <- FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param)
}
......
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