From b1fcddefc325f56bcbf59523104dd8a06decd3cf Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Fri, 8 Jan 2021 15:55:52 +0100 Subject: [PATCH] v1.6.9.9 refactor: simplify .ExtractOutputsModel code to manage StateEnd exception Refs #67 --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/Utils.R | 10 ++-------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 58ce5608..481de520 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.9.8 +Version: 1.6.9.9 Date: 2021-01-08 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 0c92f862..145e53bd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ -### 1.6.9.8 Release Notes (2021-01-08) +### 1.6.9.9 Release Notes (2021-01-08) #### New features diff --git a/R/Utils.R b/R/Utils.R index 92a54cc1..fe496be1 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -131,12 +131,6 @@ ## InputsModel .ExtractOutputsModel <- function(x, i) { - IsStateEnd <- !is.null(x$StateEnd) - if (IsStateEnd) { - IsStateEnd <- TRUE - StateEnd <- x$StateEnd - x$StateEnd <- NULL - } res <- lapply(x, function(x) { if (is.matrix(x) && length(dim(x)) == 2L) { res0 <- x[i, ] @@ -152,8 +146,8 @@ } return(res0) }) - if (IsStateEnd) { - res$StateEnd <- StateEnd + if (!is.null(x$StateEnd)) { + res$StateEnd <- x$StateEnd } class(res) <- class(x) res -- GitLab