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
airGRteaching
Commits
48919ad1
Commit
48919ad1
authored
Aug 03, 2021
by
Delaigue Olivier
Browse files
fix(SimGR): allow to rin SimGR when no Qobs on SimPer
Refs
#43
parent
778e9791
Pipeline
#25969
passed with stage
in 1 minute and 44 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
R/SimGR.R
View file @
48919ad1
...
@@ -16,11 +16,6 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
...
@@ -16,11 +16,6 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
stop
(
"Non convenient data for argument \"PrepGR\". Must be of class \"PrepGR\""
)
stop
(
"Non convenient data for argument \"PrepGR\". Must be of class \"PrepGR\""
)
}
}
isQobs
<-
!
all
(
is.na
(
PrepGR
$
Qobs
))
if
(
!
isQobs
)
{
warning
(
"\"PrepGR\" does not contain any Qobs values. The efficiency criterion is not computed"
)
}
if
(
!
missing
(
CalGR
))
{
if
(
!
missing
(
CalGR
))
{
warning
(
"Deprecated \"CalGR\" argument. Use \"Param\" instead"
)
warning
(
"Deprecated \"CalGR\" argument. Use \"Param\" instead"
)
}
}
...
@@ -74,16 +69,17 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
...
@@ -74,16 +69,17 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
}
}
MOD_opt
<-
CreateRunOptions
(
FUN_MOD
=
get
(
PrepGR
$
TypeModel
),
InputsModel
=
PrepGR
$
InputsModel
,
MOD_opt
<-
CreateRunOptions
(
FUN_MOD
=
get
(
PrepGR
$
TypeModel
),
InputsModel
=
PrepGR
$
InputsModel
,
IndPeriod_WarmUp
=
WupInd
,
IndPeriod_Run
=
SimInd
,
verbose
=
verbose
)
IndPeriod_WarmUp
=
WupInd
,
IndPeriod_Run
=
SimInd
,
verbose
=
verbose
)
if
(
isQobs
)
{
# NA in Qobs
MOD_crt
<-
CreateInputsCrit
(
FUN_CRIT
=
FUN_CRIT
,
InputsModel
=
PrepGR
$
InputsModel
,
isQobs
<-
!
all
(
is.na
(
PrepGR
$
Qobs
))
RunOptions
=
MOD_opt
,
Obs
=
PrepGR
$
Qobs
[
SimInd
],
transfo
=
transfo
)
isQobsSimPer
<-
!
all
(
is.na
(
PrepGR
$
Qobs
[
SimInd
]))
}
else
{
if
(
!
isQobs
)
{
MOD_crt
<-
NULL
warning
(
"\"PrepGR\" does not contain any Qobs values. The efficiency criterion is not computed"
)
}
else
if
(
!
isQobsSimPer
)
{
message
(
"\"PrepGR\" does not contain any Qobs values on \"SimPer\". The efficiency criterion is not computed"
)
}
}
...
@@ -91,9 +87,12 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
...
@@ -91,9 +87,12 @@ SimGR <- function(PrepGR, CalGR = NULL, Param, EffCrit = c("NSE", "KGE", "KGE2",
Param
=
Param
,
FUN_MOD
=
get
(
PrepGR
$
TypeModel
))
Param
=
Param
,
FUN_MOD
=
get
(
PrepGR
$
TypeModel
))
if
(
isQobs
)
{
if
(
isQobsSimPer
)
{
MOD_crt
<-
CreateInputsCrit
(
FUN_CRIT
=
FUN_CRIT
,
InputsModel
=
PrepGR
$
InputsModel
,
RunOptions
=
MOD_opt
,
Obs
=
PrepGR
$
Qobs
[
SimInd
],
transfo
=
transfo
)
CRT
<-
ErrorCrit
(
InputsCrit
=
MOD_crt
,
OutputsModel
=
SIM
,
verbose
=
verbose
)
CRT
<-
ErrorCrit
(
InputsCrit
=
MOD_crt
,
OutputsModel
=
SIM
,
verbose
=
verbose
)
}
else
{
}
else
{
MOD_crt
<-
NULL
CRT
<-
NULL
CRT
<-
NULL
}
}
...
...
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