From 52b3cb677d3f819e2aede28afddab6f7a8e728a7 Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Sun, 5 Apr 2020 11:02:07 +0200 Subject: [PATCH] v1.6.1.6 CLEAN: check to warn about the use of the SD or the lumped modes added in CreateInputsModel #34 --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/CreateInputsModel.R | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0b28c685..1dcba7eb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.6.1.5 +Version: 1.6.1.6 Date: 2020-04-05 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NEWS.md b/NEWS.md index 26f70024..8840495c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ -### 1.6.1.5 Release Notes (2020-04-05) +### 1.6.1.6 Release Notes (2020-04-05) #### New features diff --git a/R/CreateInputsModel.R b/R/CreateInputsModel.R index 82ed962b..34c85db7 100644 --- a/R/CreateInputsModel.R +++ b/R/CreateInputsModel.R @@ -184,12 +184,13 @@ CreateInputsModel <- function(FUN_MOD, } } + ## check semi-distributed mode if (!is.null(QobsUpstr) & !is.null(LengthHydro) & !is.null(BasinAreas)) { ObjectClass <- c(ObjectClass, "SD") } - # olivier: add a check to avoid any missing argument: - # either we have the three of them (then it is SD) or none (then it is lumped) - + if (verbose & sum(is.null(QobsUpstr) | is.null(LengthHydro) | is.null(BasinAreas)) %in% 1:2) { + warning("Missing argument: 'QobsUpstr', 'LengthHydro' and 'BasinAreas' must all be set to run in a semi-distributed mode. The lumped mode will be used") + } if ("SD" %in% ObjectClass) { if (!("daily" %in% ObjectClass) & !("hourly" %in% ObjectClass)) { stop("Only daily and hourly time steps can be used in a semi-distributed mode") -- GitLab