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
8838c840
Commit
8838c840
authored
Jan 18, 2019
by
Delaigue Olivier
Browse files
v1.1.2.32 CLEAN: minor typo revisions in CreateRunOptions
parent
544a6a46
Changes
3
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
8838c840
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.1.2.3
1
Version: 1.1.2.3
2
Date: 2019-01-18
Date: 2019-01-18
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 @
8838c840
...
@@ -13,7 +13,7 @@ output:
...
@@ -13,7 +13,7 @@ output:
### 1.1.2.3
1
Release Notes (2019-01-18)
### 1.1.2.3
2
Release Notes (2019-01-18)
...
...
R/CreateRunOptions.R
View file @
8838c840
...
@@ -5,7 +5,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -5,7 +5,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
warnings
=
TRUE
,
verbose
=
TRUE
)
{
warnings
=
TRUE
,
verbose
=
TRUE
)
{
if
(
!
missing
(
RunSnowModule
))
{
if
(
!
missing
(
RunSnowModule
))
{
warning
(
"argument RunSnowModule is deprecated; please adapt FUN_MOD instead."
,
call.
=
FALSE
)
warning
(
"argument
'
RunSnowModule
'
is deprecated; please adapt
'
FUN_MOD
'
instead."
,
call.
=
FALSE
)
}
}
ObjectClass
<-
NULL
ObjectClass
<-
NULL
...
@@ -37,60 +37,60 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -37,60 +37,60 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
BOOL
<-
TRUE
BOOL
<-
TRUE
}
}
if
(
!
BOOL
)
{
if
(
!
BOOL
)
{
stop
(
"incorrect FUN_MOD for use in CreateRunOptions \n"
)
stop
(
"incorrect
'
FUN_MOD
'
for use in
'
CreateRunOptions
'
\n"
)
return
(
NULL
)
return
(
NULL
)
}
}
##check_InputsModel
##check_InputsModel
if
(
!
inherits
(
InputsModel
,
"InputsModel"
))
{
if
(
!
inherits
(
InputsModel
,
"InputsModel"
))
{
stop
(
"InputsModel must be of class 'InputsModel' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'InputsModel' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
"GR"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"GR"
))
{
if
(
"GR"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"GR"
))
{
stop
(
"InputsModel must be of class 'GR' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'GR' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
"CemaNeige"
%in%
ObjectClass
&
if
(
"CemaNeige"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"CemaNeige"
))
{
!
inherits
(
InputsModel
,
"CemaNeige"
))
{
stop
(
"InputsModel must be of class 'CemaNeige' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'CemaNeige' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
"hourly"
%in%
ObjectClass
&
if
(
"hourly"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"hourly"
))
{
!
inherits
(
InputsModel
,
"hourly"
))
{
stop
(
"InputsModel must be of class 'hourly' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'hourly' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
"daily"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"daily"
))
{
if
(
"daily"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"daily"
))
{
stop
(
"InputsModel must be of class 'daily' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'daily' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
"monthly"
%in%
ObjectClass
&
if
(
"monthly"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"monthly"
))
{
!
inherits
(
InputsModel
,
"monthly"
))
{
stop
(
"InputsModel must be of class 'monthly' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'monthly' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
"yearly"
%in%
ObjectClass
&
if
(
"yearly"
%in%
ObjectClass
&
!
inherits
(
InputsModel
,
"yearly"
))
{
!
inherits
(
InputsModel
,
"yearly"
))
{
stop
(
"InputsModel must be of class 'yearly' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'yearly' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
##check_IndPeriod_Run
##check_IndPeriod_Run
if
(
!
is.vector
(
IndPeriod_Run
))
{
if
(
!
is.vector
(
IndPeriod_Run
))
{
stop
(
"IndPeriod_Run must be a vector of numeric values \n"
)
stop
(
"
'
IndPeriod_Run
'
must be a vector of numeric values \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
!
is.numeric
(
IndPeriod_Run
))
{
if
(
!
is.numeric
(
IndPeriod_Run
))
{
stop
(
"IndPeriod_Run must be a vector of numeric values \n"
)
stop
(
"
'
IndPeriod_Run
'
must be a vector of numeric values \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
identical
(
as.integer
(
IndPeriod_Run
),
as.integer
(
seq
(
from
=
IndPeriod_Run
[
1
],
to
=
tail
(
IndPeriod_Run
,
1
),
by
=
1
)))
==
FALSE
)
{
if
(
identical
(
as.integer
(
IndPeriod_Run
),
as.integer
(
seq
(
from
=
IndPeriod_Run
[
1
],
to
=
tail
(
IndPeriod_Run
,
1
),
by
=
1
)))
==
FALSE
)
{
stop
(
"IndPeriod_Run must be a continuous sequence of integers \n"
)
stop
(
"
'
IndPeriod_Run
'
must be a continuous sequence of integers \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
storage.mode
(
IndPeriod_Run
)
!=
"integer"
)
{
if
(
storage.mode
(
IndPeriod_Run
)
!=
"integer"
)
{
stop
(
"IndPeriod_Run should be of type integer \n"
)
stop
(
"
'
IndPeriod_Run
'
should be of type integer \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
...
@@ -162,7 +162,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -162,7 +162,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
if
(
"GR"
%in%
ObjectClass
&
(
"monthly"
%in%
ObjectClass
|
"daily"
%in%
ObjectClass
|
"hourly"
%in%
ObjectClass
))
{
if
(
"GR"
%in%
ObjectClass
&
(
"monthly"
%in%
ObjectClass
|
"daily"
%in%
ObjectClass
|
"hourly"
%in%
ObjectClass
))
{
if
(
!
is.null
(
IniResLevels
))
{
if
(
!
is.null
(
IniResLevels
))
{
if
(
!
is.vector
(
IniResLevels
)
|
!
is.numeric
(
IniResLevels
)
|
any
(
is.na
(
IniResLevels
)))
{
if
(
!
is.vector
(
IniResLevels
)
|
!
is.numeric
(
IniResLevels
)
|
any
(
is.na
(
IniResLevels
)))
{
stop
(
"IniResLevels must be a vector of numeric values \n"
)
stop
(
"
'
IniResLevels
'
must be a vector of numeric values \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
((
identical
(
FUN_MOD
,
RunModel_GR4H
)
|
if
((
identical
(
FUN_MOD
,
RunModel_GR4H
)
|
...
@@ -170,12 +170,12 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -170,12 +170,12 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
identical
(
FUN_MOD
,
RunModel_GR5J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR5J
)
|
identical
(
FUN_MOD
,
RunModel_GR5J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR5J
)
|
identical
(
FUN_MOD
,
RunModel_GR2M
))
&
identical
(
FUN_MOD
,
RunModel_GR2M
))
&
length
(
IniResLevels
)
!=
2
)
{
length
(
IniResLevels
)
!=
2
)
{
stop
(
"The length of IniResLevels must be 2 for the chosen FUN_MOD \n"
)
stop
(
"The length of
'
IniResLevels
'
must be 2 for the chosen
'
FUN_MOD
'
\n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
((
identical
(
FUN_MOD
,
RunModel_GR6J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR6J
))
&
if
((
identical
(
FUN_MOD
,
RunModel_GR6J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR6J
))
&
length
(
IniResLevels
)
!=
3
)
{
length
(
IniResLevels
)
!=
3
)
{
stop
(
"The length of IniResLevels must be 3 for the chosen FUN_MOD \n"
)
stop
(
"The length of
'
IniResLevels
'
must be 3 for the chosen
'
FUN_MOD
'
\n"
)
return
(
NULL
)
return
(
NULL
)
}
}
}
else
if
(
is.null
(
IniStates
))
{
}
else
if
(
is.null
(
IniStates
))
{
...
@@ -187,7 +187,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -187,7 +187,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
}
}
}
else
{
}
else
{
if
(
!
is.null
(
IniResLevels
))
{
if
(
!
is.null
(
IniResLevels
))
{
stop
(
"IniResLevels can only be used with monthly or daily or hourly GR models \n"
)
stop
(
"
'
IniResLevels
'
can only be used with monthly or daily or hourly GR models \n"
)
}
}
}
}
## check IniStates
## check IniStates
...
@@ -195,7 +195,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -195,7 +195,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
warning
(
"\t Model states initialisation not defined -> default configuration used \n"
)
warning
(
"\t Model states initialisation not defined -> default configuration used \n"
)
}
}
if
(
!
is.null
(
IniStates
)
&
!
is.null
(
IniResLevels
)
&
warnings
)
{
if
(
!
is.null
(
IniStates
)
&
!
is.null
(
IniResLevels
)
&
warnings
)
{
warning
(
"\t IniStates and IniResLevels are both defined -> Store levels are taken from IniResLevels \n"
)
warning
(
"\t
'
IniStates
'
and
'
IniResLevels
'
are both defined -> Store levels are taken from
'
IniResLevels
'
\n"
)
}
}
if
(
"CemaNeige"
%in%
ObjectClass
)
{
if
(
"CemaNeige"
%in%
ObjectClass
)
{
NLayers
<-
length
(
InputsModel
$
LayerPrecip
)
NLayers
<-
length
(
InputsModel
$
LayerPrecip
)
...
@@ -220,27 +220,27 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -220,27 +220,27 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
if
(
!
is.null
(
IniStates
))
{
if
(
!
is.null
(
IniStates
))
{
if
(
!
inherits
(
IniStates
,
"IniStates"
))
{
if
(
!
inherits
(
IniStates
,
"IniStates"
))
{
stop
(
"IniStates must be an object of class IniStates\n"
)
stop
(
"
'
IniStates
'
must be an object of class
'
IniStates
'
\n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
sum
(
ObjectClass
%in%
class
(
IniStates
))
<
2
)
{
if
(
sum
(
ObjectClass
%in%
class
(
IniStates
))
<
2
)
{
stop
(
paste0
(
"Non convenient IniStates for this FUN_MOD\n"
))
stop
(
paste0
(
"Non convenient
'
IniStates
'
for this
'
FUN_MOD
'
\n"
))
return
(
NULL
)
return
(
NULL
)
}
}
if
(
identical
(
FUN_MOD
,
RunModel_GR1A
)
&
!
is.null
(
IniStates
))
{
## GR1A
if
(
identical
(
FUN_MOD
,
RunModel_GR1A
)
&
!
is.null
(
IniStates
))
{
## GR1A
stop
(
paste0
(
"IniStates is not available for this FUN_MOD\n"
))
stop
(
paste0
(
"
'
IniStates
'
is not available for this
'
FUN_MOD
'
\n"
))
return
(
NULL
)
return
(
NULL
)
}
}
if
((
identical
(
FUN_MOD
,
RunModel_GR5J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR5J
))
&
!
all
(
is.na
(
IniStates
$
UH
$
UH1
)))
{
## GR5J
if
((
identical
(
FUN_MOD
,
RunModel_GR5J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR5J
))
&
!
all
(
is.na
(
IniStates
$
UH
$
UH1
)))
{
## GR5J
stop
(
paste0
(
"Non convenient IniStates for this FUN_MOD. In IniStates, UH1 has to be a vector of NA for GR5J \n"
))
stop
(
paste0
(
"Non convenient IniStates for this
'
FUN_MOD.
'
In
'
IniStates
'
, UH1 has to be a vector of NA for GR5J \n"
))
return
(
NULL
)
return
(
NULL
)
}
}
if
((
identical
(
FUN_MOD
,
RunModel_GR6J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR6J
))
&
is.na
(
IniStates
$
Store
$
Exp
))
{
## GR6J
if
((
identical
(
FUN_MOD
,
RunModel_GR6J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR6J
))
&
is.na
(
IniStates
$
Store
$
Exp
))
{
## GR6J
stop
(
paste0
(
"Non convenient IniStates for this FUN_MOD. GR6J needs an exponential store value in IniStates \n"
))
stop
(
paste0
(
"Non convenient IniStates for this
'
FUN_MOD.
'
GR6J needs an exponential store value in
'
IniStates
'
\n"
))
return
(
NULL
)
return
(
NULL
)
}
}
if
(
!
(
identical
(
FUN_MOD
,
RunModel_GR6J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR6J
))
&
!
is.na
(
IniStates
$
Store
$
Exp
))
{
## except GR6J
if
(
!
(
identical
(
FUN_MOD
,
RunModel_GR6J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR6J
))
&
!
is.na
(
IniStates
$
Store
$
Exp
))
{
## except GR6J
stop
(
paste0
(
"Non convenient IniStates for this FUN_MOD. No exponential store value needed in IniStates \n"
))
stop
(
paste0
(
"Non convenient IniStates for this
'
FUN_MOD.
'
No exponential store value needed in
'
IniStates
'
\n"
))
return
(
NULL
)
return
(
NULL
)
}
}
# if (length(na.omit(unlist(IniStates))) != NState) {
# if (length(na.omit(unlist(IniStates))) != NState) {
...
@@ -269,7 +269,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -269,7 +269,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
##Outputs_all
##Outputs_all
Outputs_all
<-
NULL
Outputs_all
<-
NULL
if
(
identical
(
FUN_MOD
,
RunModel_GR4H
))
{
if
(
identical
(
FUN_MOD
,
RunModel_GR4H
))
{
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"Prod"
,
"AE"
,
"Perc"
,
"PR"
,
"Q9"
,
"Q1"
,
"Rout"
,
"Exch"
,
"AExch"
,
"QR"
,
"QD"
,
"Qsim"
)
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"Prod"
,
"AE"
,
"Perc"
,
"PR"
,
"Q9"
,
"Q1"
,
"Rout"
,
"Exch"
,
"AExch"
,
"QR"
,
"QD"
,
"Qsim"
)
}
}
if
(
identical
(
FUN_MOD
,
RunModel_GR4J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR4J
))
{
if
(
identical
(
FUN_MOD
,
RunModel_GR4J
)
|
identical
(
FUN_MOD
,
RunModel_CemaNeigeGR4J
))
{
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"Prod"
,
"Pn"
,
"Ps"
,
"AE"
,
"Perc"
,
"PR"
,
"Q9"
,
"Q1"
,
"Rout"
,
"Exch"
,
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"Prod"
,
"Pn"
,
"Ps"
,
"AE"
,
"Perc"
,
"PR"
,
"Q9"
,
"Q1"
,
"Rout"
,
"Exch"
,
...
@@ -287,10 +287,10 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -287,10 +287,10 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"AE"
,
"Pn"
,
"Perc"
,
"PR"
,
"Exch"
,
"Prod"
,
"Rout"
,
"Qsim"
)
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"AE"
,
"Pn"
,
"Perc"
,
"PR"
,
"Exch"
,
"Prod"
,
"Rout"
,
"Qsim"
)
}
}
if
(
identical
(
FUN_MOD
,
RunModel_GR1A
))
{
if
(
identical
(
FUN_MOD
,
RunModel_GR1A
))
{
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"Qsim"
)
Outputs_all
<-
c
(
Outputs_all
,
"PotEvap"
,
"Precip"
,
"Qsim"
)
}
}
if
(
"CemaNeige"
%in%
ObjectClass
)
{
if
(
"CemaNeige"
%in%
ObjectClass
)
{
Outputs_all
<-
c
(
Outputs_all
,
"Pliq"
,
"Psol"
,
"SnowPack"
,
"ThermalState"
,
"Gratio"
,
"PotMelt"
,
"Melt"
,
"PliqAndMelt"
,
"Temp"
)
Outputs_all
<-
c
(
Outputs_all
,
"Pliq"
,
"Psol"
,
"SnowPack"
,
"ThermalState"
,
"Gratio"
,
"PotMelt"
,
"Melt"
,
"PliqAndMelt"
,
"Temp"
)
}
}
##check_Outputs_Sim
##check_Outputs_Sim
...
@@ -311,7 +311,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -311,7 +311,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
}
}
Test
<-
which
(
Outputs_Sim
%in%
c
(
"DatesR"
,
Outputs_all
,
"StateEnd"
)
==
FALSE
)
Test
<-
which
(
Outputs_Sim
%in%
c
(
"DatesR"
,
Outputs_all
,
"StateEnd"
)
==
FALSE
)
if
(
length
(
Test
)
!=
0
)
{
if
(
length
(
Test
)
!=
0
)
{
stop
(
paste0
(
"Outputs_Sim is incorrectly defined: "
,
stop
(
paste0
(
"
'
Outputs_Sim
'
is incorrectly defined: "
,
paste
(
Outputs_Sim
[
Test
],
collapse
=
", "
),
" not found \n"
))
paste
(
Outputs_Sim
[
Test
],
collapse
=
", "
),
" not found \n"
))
return
(
NULL
)
return
(
NULL
)
...
@@ -333,15 +333,15 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -333,15 +333,15 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
}
}
}
else
{
}
else
{
if
(
!
is.vector
(
Outputs_Cal
))
{
if
(
!
is.vector
(
Outputs_Cal
))
{
stop
(
"Outputs_Cal must be a vector of characters \n"
)
stop
(
"
'
Outputs_Cal
'
must be a vector of characters \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
!
is.character
(
Outputs_Cal
))
{
if
(
!
is.character
(
Outputs_Cal
))
{
stop
(
"Outputs_Cal must be a vector of characters \n"
)
stop
(
"
'
Outputs_Cal
'
must be a vector of characters \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
if
(
sum
(
is.na
(
Outputs_Cal
))
!=
0
)
{
if
(
sum
(
is.na
(
Outputs_Cal
))
!=
0
)
{
stop
(
"Outputs_Cal must not contain NA \n"
)
stop
(
"
'
Outputs_Cal
'
must not contain NA \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
}
}
...
@@ -352,7 +352,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -352,7 +352,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
Test
<-
Test
<-
which
(
Outputs_Cal
%in%
c
(
"DatesR"
,
Outputs_all
,
"StateEnd"
)
==
FALSE
)
which
(
Outputs_Cal
%in%
c
(
"DatesR"
,
Outputs_all
,
"StateEnd"
)
==
FALSE
)
if
(
length
(
Test
)
!=
0
)
{
if
(
length
(
Test
)
!=
0
)
{
stop
(
paste0
(
"Outputs_Cal is incorrectly defined: "
,
stop
(
paste0
(
"
'
Outputs_Cal
'
is incorrectly defined: "
,
paste
(
Outputs_Cal
[
Test
],
collapse
=
", "
),
" not found \n"
))
paste
(
Outputs_Cal
[
Test
],
collapse
=
", "
),
" not found \n"
))
return
(
NULL
)
return
(
NULL
)
...
@@ -388,7 +388,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -388,7 +388,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
Factor
<-
1
Factor
<-
1
}
}
if
(
is.null
(
Factor
))
{
if
(
is.null
(
Factor
))
{
stop
(
"InputsModel must be of class 'hourly', 'daily', 'monthly' or 'yearly' \n"
)
stop
(
"
'
InputsModel
'
must be of class 'hourly', 'daily', 'monthly' or 'yearly' \n"
)
return
(
NULL
)
return
(
NULL
)
}
}
MeanAnSolidPrecip
<-
rep
(
mean
(
SolidPrecip
)
*
Factor
,
NLayers
)
MeanAnSolidPrecip
<-
rep
(
mean
(
SolidPrecip
)
*
Factor
,
NLayers
)
...
@@ -401,15 +401,15 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -401,15 +401,15 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
}
}
if
(
"CemaNeige"
%in%
ObjectClass
&
!
is.null
(
MeanAnSolidPrecip
))
{
if
(
"CemaNeige"
%in%
ObjectClass
&
!
is.null
(
MeanAnSolidPrecip
))
{
if
(
!
is.vector
(
MeanAnSolidPrecip
))
{
if
(
!
is.vector
(
MeanAnSolidPrecip
))
{
stop
(
paste0
(
"MeanAnSolidPrecip must be a vector of numeric values \n"
))
stop
(
paste0
(
"
'
MeanAnSolidPrecip
'
must be a vector of numeric values \n"
))
return
(
NULL
)
return
(
NULL
)
}
}
if
(
!
is.numeric
(
MeanAnSolidPrecip
))
{
if
(
!
is.numeric
(
MeanAnSolidPrecip
))
{
stop
(
paste0
(
"MeanAnSolidPrecip must be a vector of numeric values \n"
))
stop
(
paste0
(
"
'
MeanAnSolidPrecip
'
must be a vector of numeric values \n"
))
return
(
NULL
)
return
(
NULL
)
}
}
if
(
length
(
MeanAnSolidPrecip
)
!=
NLayers
)
{
if
(
length
(
MeanAnSolidPrecip
)
!=
NLayers
)
{
stop
(
paste0
(
"MeanAnSolidPrecip must be a numeric vector of length "
,
NLayers
,
" \n"
))
stop
(
paste0
(
"
'
MeanAnSolidPrecip
'
must be a numeric vector of length "
,
NLayers
,
" \n"
))
return
(
NULL
)
return
(
NULL
)
}
}
}
}
...
@@ -419,7 +419,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -419,7 +419,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
if
(
"GR"
%in%
ObjectClass
&
"CemaNeige"
%in%
ObjectClass
)
{
if
(
"GR"
%in%
ObjectClass
&
"CemaNeige"
%in%
ObjectClass
)
{
if
(
"PliqAndMelt"
%in%
Outputs_Cal
==
FALSE
&
"all"
%in%
Outputs_Cal
==
FALSE
)
{
if
(
"PliqAndMelt"
%in%
Outputs_Cal
==
FALSE
&
"all"
%in%
Outputs_Cal
==
FALSE
)
{
WTxt
<-
NULL
WTxt
<-
NULL
WTxt
<-
paste0
(
WTxt
,
"\t PliqAndMelt was not defined in Outputs_Cal but is needed to feed the hydrological model with the snow modele outputs \n"
)
WTxt
<-
paste0
(
WTxt
,
"\t
'
PliqAndMelt
'
was not defined in
'
Outputs_Cal
'
but is needed to feed the hydrological model with the snow modele outputs \n"
)
WTxt
<-
paste0
(
WTxt
,
"\t -> it was automatically added \n"
)
WTxt
<-
paste0
(
WTxt
,
"\t -> it was automatically added \n"
)
if
(
!
is.null
(
WTxt
)
&
warnings
)
{
if
(
!
is.null
(
WTxt
)
&
warnings
)
{
warning
(
WTxt
)
warning
(
WTxt
)
...
@@ -428,7 +428,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
...
@@ -428,7 +428,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
}
}
if
(
"PliqAndMelt"
%in%
Outputs_Sim
==
FALSE
&
"all"
%in%
Outputs_Sim
==
FALSE
)
{
if
(
"PliqAndMelt"
%in%
Outputs_Sim
==
FALSE
&
"all"
%in%
Outputs_Sim
==
FALSE
)
{
WTxt
<-
NULL
WTxt
<-
NULL
WTxt
<-
paste0
(
WTxt
,
"\t PliqAndMelt was not defined in Outputs_Sim but is needed to feed the hydrological model with the snow modele outputs \n"
)
WTxt
<-
paste0
(
WTxt
,
"\t
'
PliqAndMelt
'
was not defined in
'
Outputs_Sim
'
but is needed to feed the hydrological model with the snow modele outputs \n"
)
WTxt
<-
paste0
(
WTxt
,
"\t -> it was automatically added \n"
)
WTxt
<-
paste0
(
WTxt
,
"\t -> it was automatically added \n"
)
if
(
!
is.null
(
WTxt
)
&
warnings
)
{
if
(
!
is.null
(
WTxt
)
&
warnings
)
{
warning
(
WTxt
)
warning
(
WTxt
)
...
...
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