Commit b1fcddef authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.9.9 refactor: simplify .ExtractOutputsModel code to manage StateEnd exception

Refs #67
parent d374b49f
Pipeline #18989 passed with stages
in 12 minutes and 11 seconds
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")),
......
......@@ -2,7 +2,7 @@
### 1.6.9.8 Release Notes (2021-01-08)
### 1.6.9.9 Release Notes (2021-01-08)
#### New features
......
......@@ -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
......
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