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
b461d285
Commit
b461d285
authored
Mar 25, 2019
by
Delaigue Olivier
Browse files
v1.2.11.10 BUG: check of range values now works when there is only one Q, SCA or SCE varObs
parent
28b6c1d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
b461d285
Package: airGR
Package: airGR
Type: Package
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.2.11.
9
Version: 1.2.11.
10
Date: 2019-03-25
Date: 2019-03-25
Authors@R: c(
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
...
...
NEWS.rmd
View file @
b461d285
...
@@ -13,7 +13,7 @@ output:
...
@@ -13,7 +13,7 @@ output:
### 1.2.11.
9
Release Notes (2019-03-25)
### 1.2.11.
10
Release Notes (2019-03-25)
...
...
R/CreateInputsCrit.R
View file @
b461d285
...
@@ -85,6 +85,9 @@ CreateInputsCrit <- function(FUN_CRIT,
...
@@ -85,6 +85,9 @@ CreateInputsCrit <- function(FUN_CRIT,
listArgs
[[
iArgs
]]
<-
lapply
(
seq_along
(
listArgs
$
FUN_CRIT
),
function
(
x
)
NULL
)
listArgs
[[
iArgs
]]
<-
lapply
(
seq_along
(
listArgs
$
FUN_CRIT
),
function
(
x
)
NULL
)
}
}
}
}
if
(
iArgs
%in%
c
(
"FUN_CRIT"
,
"varObs"
,
"transfo"
,
"weights"
)
&
length
(
listArgs
[[
iArgs
]])
>
1L
)
{
listArgs
[[
iArgs
]]
<-
as.list
(
listArgs
[[
iArgs
]])
}
if
(
!
is.list
(
listArgs
[[
iArgs
]]))
{
if
(
!
is.list
(
listArgs
[[
iArgs
]]))
{
listArgs
[[
iArgs
]]
<-
list
(
listArgs
[[
iArgs
]])
listArgs
[[
iArgs
]]
<-
list
(
listArgs
[[
iArgs
]])
}
}
...
@@ -196,7 +199,11 @@ CreateInputsCrit <- function(FUN_CRIT,
...
@@ -196,7 +199,11 @@ CreateInputsCrit <- function(FUN_CRIT,
## check 'varObs' + 'obs'
## check 'varObs' + 'obs'
if
(
any
(
iListArgs2
$
varObs
%in%
"SCA"
))
{
if
(
any
(
iListArgs2
$
varObs
%in%
"SCA"
))
{
idSCA
<-
which
(
iListArgs2
$
varObs
==
"SCA"
)
idSCA
<-
which
(
iListArgs2
$
varObs
==
"SCA"
)
vecSCA
<-
unlist
(
iListArgs2
$
obs
[
idSCA
])
if
(
length
(
idSCA
)
==
1L
)
{
vecSCA
<-
iListArgs2
$
obs
}
else
{
vecSCA
<-
unlist
(
iListArgs2
$
obs
[
idSCA
])
}
if
(
min
(
vecSCA
,
na.rm
=
TRUE
)
<
0
|
max
(
vecSCA
,
na.rm
=
TRUE
)
>
1
)
{
if
(
min
(
vecSCA
,
na.rm
=
TRUE
)
<
0
|
max
(
vecSCA
,
na.rm
=
TRUE
)
>
1
)
{
stop
(
"'obs' outside [0,1] for \"SCA\""
,
call.
=
FALSE
)
stop
(
"'obs' outside [0,1] for \"SCA\""
,
call.
=
FALSE
)
}
}
...
@@ -204,7 +211,11 @@ CreateInputsCrit <- function(FUN_CRIT,
...
@@ -204,7 +211,11 @@ CreateInputsCrit <- function(FUN_CRIT,
inPosVarObs
<-
c
(
"Q"
,
"SWE"
)
inPosVarObs
<-
c
(
"Q"
,
"SWE"
)
if
(
any
(
iListArgs2
$
varObs
%in%
inPosVarObs
))
{
if
(
any
(
iListArgs2
$
varObs
%in%
inPosVarObs
))
{
idQSS
<-
which
(
iListArgs2
$
varObs
%in%
inPosVarObs
)
idQSS
<-
which
(
iListArgs2
$
varObs
%in%
inPosVarObs
)
vecQSS
<-
unlist
(
iListArgs2
$
obs
[
idQSS
])
if
(
length
(
idQSS
)
==
1L
)
{
vecQSS
<-
iListArgs2
$
obs
}
else
{
vecQSS
<-
unlist
(
iListArgs2
$
obs
[
idQSS
])
}
if
(
min
(
vecQSS
,
na.rm
=
TRUE
)
<
0
)
{
if
(
min
(
vecQSS
,
na.rm
=
TRUE
)
<
0
)
{
stop
(
sprintf
(
"'obs' outside [0,Inf[ for \"%s\""
,
iListArgs2
$
varObs
),
call.
=
FALSE
)
stop
(
sprintf
(
"'obs' outside [0,Inf[ for \"%s\""
,
iListArgs2
$
varObs
),
call.
=
FALSE
)
}
}
...
@@ -248,7 +259,7 @@ CreateInputsCrit <- function(FUN_CRIT,
...
@@ -248,7 +259,7 @@ CreateInputsCrit <- function(FUN_CRIT,
obs
=
iListArgs2
$
obs
,
obs
=
iListArgs2
$
obs
,
varObs
=
iListArgs2
$
varObs
,
varObs
=
iListArgs2
$
varObs
,
BoolCrit
=
iListArgs2
$
BoolCrit
,
BoolCrit
=
iListArgs2
$
BoolCrit
,
idLayer
=
iListArgs2
$
idLayer
,
idLayer
=
iListArgs2
$
idLayer
,
transfo
=
iListArgs2
$
transfo
,
transfo
=
iListArgs2
$
transfo
,
epsilon
=
iListArgs2
$
epsilon
,
epsilon
=
iListArgs2
$
epsilon
,
weights
=
iListArgs2
$
weights
)
weights
=
iListArgs2
$
weights
)
...
...
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