Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HYCAR-Hydro
airGR
Commits
104d22ba
Commit
104d22ba
authored
Oct 26, 2021
by
Dorchies David
Browse files
fix: failed checks
Refs #137
parent
f04096da
Pipeline
#28592
failed with stages
in 13 minutes and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
R/RunModel_Lag.R
View file @
104d22ba
...
...
@@ -22,19 +22,19 @@ RunModel_Lag <- function(InputsModel, RunOptions, Param, QcontribDown) {
stop
(
"'QcontribDown' should contain a key 'Qsim' containing the output of the runoff of the downstream subcatchment"
)
}
if
(
length
(
QcontribDown
$
Qsim
)
!=
length
(
RunOptions
$
IndPeriod_Run
))
{
stop
(
"Time series Qsim in 'QcontribDown' should have the same leng
h
t as 'RunOptions$IndPeriod_Run'"
)
stop
(
"Time series Qsim in 'QcontribDown' should have the same lengt
h
as 'RunOptions$IndPeriod_Run'"
)
}
if
(
!
identical
(
RunOptions
$
IndPeriod_WarmUp
,
0L
)
&&
RunOptions
$
Outputs_Sim
!=
RunOptions
$
Outputs_Cal
)
{
if
(
!
identical
(
RunOptions
$
IndPeriod_WarmUp
,
0L
)
&&
!
identical
(
RunOptions
$
Outputs_Sim
,
RunOptions
$
Outputs_Cal
)
)
{
# This test is not necessary during calibration but usefull in other cases because
# WarmUpQsim is then used for downstream sub-basins because of the delay in Qupstream
if
(
is.null
(
QcontribDown
$
RunOptions
$
WarmUpQsim
)
||
length
(
QcontribDown
$
RunOptions
$
WarmUpQsim
)
!=
length
(
RunOptions
$
IndPeriod_WarmUp
))
{
stop
(
"Time series WarmUpQsim in 'QcontribDown' should have the same leng
h
t as 'RunOptions$IndPeriod_WarmUp'"
)
stop
(
"Time series WarmUpQsim in 'QcontribDown' should have the same lengt
h
as 'RunOptions$IndPeriod_WarmUp'"
)
}
}
}
else
if
(
is.vector
(
QcontribDown
)
&&
is.numeric
(
QcontribDown
))
{
if
(
length
(
QcontribDown
)
!=
length
(
RunOptions
$
IndPeriod_Run
))
{
stop
(
"'QcontribDown' should have the same leng
h
t as 'RunOptions$IndPeriod_Run'"
)
stop
(
"'QcontribDown' should have the same lengt
h
as 'RunOptions$IndPeriod_Run'"
)
}
}
else
{
stop
(
"'QcontribDown' must be a numeric vector or a 'OutputsModel' object"
)
...
...
tests/testthat/test-RunModel_Lag.R
View file @
104d22ba
...
...
@@ -72,12 +72,12 @@ test_that("QcontribDown should contain a Qsim key", {
)
})
test_that
(
"'QcontribDown$Qim' should have the same leng
h
t as 'RunOptions$IndPeriod_Run'"
,
{
test_that
(
"'QcontribDown$Qim' should have the same lengt
h
as 'RunOptions$IndPeriod_Run'"
,
{
QcontribDown
<-
OutputsGR4JOnly
QcontribDown
$
Qsim
<-
c
(
QcontribDown
$
Qsim
,
0
)
expect_error
(
RunModel_Lag
(
InputsModel
=
InputsModel
,
RunOptions
=
RunOptions
,
Param
=
1
,
QcontribDown
=
QcontribDown
),
regexp
=
"should have the same leng
h
t as"
regexp
=
"should have the same lengt
h
as"
)
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment