Commit 0cdd8938 authored by Dorchies David's avatar Dorchies David

v1.6.2.2 feat: limit negative flow in SD model

- if direct upstream flow leads to negative downstream flow a warning is displayed and downstream flow is set to zero

Refs #34
parent baffd2ea
Pipeline #13626 passed with stages
in 12 minutes and 34 seconds
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.2.1
Version: 1.6.2.2
Date: 2020-06-05
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -36,6 +36,11 @@ RunModel <- function (InputsModel, RunOptions, Param, FUN_MOD) {
Qupstream[(2 + floor(PT[upstream_basin])):LengthTs]) *
HUTRANS[2, upstream_basin]
}
# Warning for negative flows
if(any(OutputsModelDown$Qsim < 0)) {
warning(length(which(OutputsModelDown$Qsim < 0)), " time steps with negative flow, set to zero.")
OutputsModelDown$Qsim[OutputsModelDown$Qsim < 0] <- 0
}
# Convert back Qsim to mm
OutputsModelDown$Qsim <- OutputsModelDown$Qsim / sum(InputsModel$BasinAreas, na.rm = TRUE) / 1E3
......
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