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
5dce7a71
Commit
5dce7a71
authored
Jun 22, 2017
by
unknown
Browse files
v1.0.9.0 bug fixed with in RunModel_CemaNeige* when CreateIniStates is called #4422
parent
d75dad9e
Changes
10
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
5dce7a71
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.0.
8.9
Version: 1.0.
9.0
Date: 2017-06-22
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")),
...
...
R/RunModel_CemaNeigeGR4J.R
View file @
5dce7a71
...
...
@@ -3,8 +3,8 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
NParam
<-
6
;
FortranOutputsCemaNeige
<-
c
(
"Pliq"
,
"Psol"
,
"SnowPack"
,
"ThermalState"
,
"Gratio"
,
"PotMelt"
,
"Melt"
,
"PliqAndMelt"
,
"Temp"
);
FortranOutputsMod
<-
c
(
"PotEvap"
,
"Precip"
,
"Prod"
,
"Pn"
,
"Ps"
,
"AE"
,
"Perc"
,
"PR"
,
"Q9"
,
"Q1"
,
"Rout"
,
"Exch"
,
"AExch1"
,
"AExch2"
,
"AExch"
,
"QR"
,
"QD"
,
"Qsim"
);
"AExch1"
,
"AExch2"
,
"AExch"
,
"QR"
,
"QD"
,
"Qsim"
);
##Arguments_check
if
(
inherits
(
InputsModel
,
"InputsModel"
)
==
FALSE
){
stop
(
"InputsModel must be of class 'InputsModel' \n"
);
return
(
NULL
);
}
if
(
inherits
(
InputsModel
,
"daily"
)
==
FALSE
){
stop
(
"InputsModel must be of class 'daily' \n"
);
return
(
NULL
);
}
...
...
@@ -45,7 +45,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##SNOW_MODULE________________________________________________________________________________##
if
(
RunOptions
$
RunSnowModule
==
TRUE
){
if
(
"all"
%in%
RunOptions
$
Outputs_Sim
){
IndOutputsCemaNeige
<-
as.integer
(
1
:
length
(
FortranOutputsCemaNeige
));
...
...
@@ -74,8 +74,8 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
##Data_storage
CemaNeigeLayers
[[
iLayer
]]
<-
lapply
(
seq_len
(
RESULTS
$
NOutputs
),
function
(
i
)
RESULTS
$
Outputs
[
IndPeriod2
,
i
]);
names
(
CemaNeigeLayers
[[
iLayer
]])
<-
FortranOutputsCemaNeige
[
IndOutputsCemaNeige
];
...
...
@@ -121,12 +121,14 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_CemaNeigeGR4J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
1
]],
eTGCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
0
]],
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_CemaNeigeGR4J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
1
]],
eTGCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
0
]],
verbose
=
FALSE
)
}
if
(
RunOptions
$
RunSnowModule
&
"Precip"
%in%
RunOptions
$
Outputs_Sim
){
RESULTS
$
Outputs
[,
which
(
FortranOutputsMod
[
IndOutputsMod
]
==
"Precip"
)]
<-
InputsModel
$
Precip
[
IndPeriod1
];
}
...
...
R/RunModel_CemaNeigeGR5J.R
View file @
5dce7a71
...
...
@@ -120,12 +120,14 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_CemaNeigeGR5J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
NULL
,
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
1
]],
eTGCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
0
]],
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_CemaNeigeGR5J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
NULL
,
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
1
]],
eTGCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
0
]],
verbose
=
FALSE
)
}
if
(
RunOptions
$
RunSnowModule
&
"Precip"
%in%
RunOptions
$
Outputs_Sim
){
RESULTS
$
Outputs
[,
which
(
FortranOutputsMod
[
IndOutputsMod
]
==
"Precip"
)]
<-
InputsModel
$
Precip
[
IndPeriod1
];
}
...
...
R/RunModel_CemaNeigeGR6J.R
View file @
5dce7a71
...
...
@@ -126,12 +126,14 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_CemaNeigeGR6J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
RESULTS
$
StateEnd
[
3L
],
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
1
]],
eTGCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
0
]],
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_CemaNeigeGR6J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
RESULTS
$
StateEnd
[
3L
],
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
1
]],
eTGCemaNeigeLayers
=
CemaNeigeStateEnd
[
seq_len
(
2
*
NLayers
)[
seq_len
(
2
*
NLayers
)
%%
2
==
0
]],
verbose
=
FALSE
)
}
if
(
RunOptions
$
RunSnowModule
&
"Precip"
%in%
RunOptions
$
Outputs_Sim
){
RESULTS
$
Outputs
[,
which
(
FortranOutputsMod
[
IndOutputsMod
]
==
"Precip"
)]
<-
InputsModel
$
Precip
[
IndPeriod1
];
}
...
...
R/RunModel_GR1A.R
View file @
5dce7a71
...
...
@@ -20,6 +20,10 @@ RunModel_GR1A <- function(InputsModel,RunOptions,Param){
if
(
"all"
%in%
RunOptions
$
Outputs_Sim
){
IndOutputs
<-
as.integer
(
1
:
length
(
FortranOutputs
));
}
else
{
IndOutputs
<-
which
(
FortranOutputs
%in%
RunOptions
$
Outputs_Sim
);
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
BOOL_Fortran
<-
FALSE
;
if
(
BOOL_Fortran
){
##Call_fortan
...
...
@@ -56,9 +60,6 @@ RunModel_GR1A <- function(InputsModel,RunOptions,Param){
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##OutputsModel_only
if
(
ExportDatesR
==
FALSE
&
ExportStateEnd
==
FALSE
){
OutputsModel
<-
lapply
(
seq_len
(
RESULTS
$
NOutputs
),
function
(
i
)
RESULTS
$
Outputs
[
IndPeriod2
,
i
]);
...
...
R/RunModel_GR2M.R
View file @
5dce7a71
...
...
@@ -30,6 +30,11 @@ RunModel_GR2M <- function(InputsModel,RunOptions,Param){
if
(
"all"
%in%
RunOptions
$
Outputs_Sim
){
IndOutputs
<-
as.integer
(
1
:
length
(
FortranOutputs
));
}
else
{
IndOutputs
<-
which
(
FortranOutputs
%in%
RunOptions
$
Outputs_Sim
);
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##Use_of_IniResLevels
if
(
!
is.null
(
RunOptions
$
IniResLevels
)){
RunOptions
$
IniStates
[
1
]
<-
RunOptions
$
IniResLevels
[
1
]
*
Param
[
1
];
### production store level (mm)
...
...
@@ -54,17 +59,16 @@ RunModel_GR2M <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR2M
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
NULL
,
UH2
=
NULL
,
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR2M
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
NULL
,
UH2
=
NULL
,
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##OutputsModel_only
if
(
ExportDatesR
==
FALSE
&
ExportStateEnd
==
FALSE
){
OutputsModel
<-
lapply
(
seq_len
(
RESULTS
$
NOutputs
),
function
(
i
)
RESULTS
$
Outputs
[
IndPeriod2
,
i
]);
...
...
R/RunModel_GR4H.R
View file @
5dce7a71
...
...
@@ -35,6 +35,11 @@ RunModel_GR4H <- function(InputsModel,RunOptions,Param){
if
(
"all"
%in%
RunOptions
$
Outputs_Sim
){
IndOutputs
<-
as.integer
(
1
:
length
(
FortranOutputs
));
}
else
{
IndOutputs
<-
which
(
FortranOutputs
%in%
RunOptions
$
Outputs_Sim
);
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##Use_of_IniResLevels
if
(
!
is.null
(
RunOptions
$
IniResLevels
)){
RunOptions
$
IniStates
[
1
]
<-
RunOptions
$
IniResLevels
[
1
]
*
Param
[
1
];
### production store level (mm)
...
...
@@ -59,16 +64,15 @@ RunModel_GR4H <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR4H
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
RESULTS
$
StateEnd
[(
1
:
(
20
*
24
))
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
(
40
*
24
))
+
(
7+20
*
24
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR4H
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
RESULTS
$
StateEnd
[(
1
:
(
20
*
24
))
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
(
40
*
24
))
+
(
7+20
*
24
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##OutputsModel_only
if
(
ExportDatesR
==
FALSE
&
ExportStateEnd
==
FALSE
){
OutputsModel
<-
lapply
(
seq_len
(
RESULTS
$
NOutputs
),
function
(
i
)
RESULTS
$
Outputs
[
IndPeriod2
,
i
]);
...
...
R/RunModel_GR4J.R
View file @
5dce7a71
...
...
@@ -35,6 +35,10 @@ RunModel_GR4J <- function(InputsModel,RunOptions,Param){
LInputSeries
<-
as.integer
(
length
(
IndPeriod1
))
if
(
"all"
%in%
RunOptions
$
Outputs_Sim
){
IndOutputs
<-
as.integer
(
1
:
length
(
FortranOutputs
));
}
else
{
IndOutputs
<-
which
(
FortranOutputs
%in%
RunOptions
$
Outputs_Sim
);
}
##Input_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##Use_of_IniResLevels
if
(
!
is.null
(
RunOptions
$
IniResLevels
)){
...
...
@@ -60,16 +64,15 @@ RunModel_GR4J <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR4J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR4J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##OutputsModel_only
if
(
ExportDatesR
==
FALSE
&
ExportStateEnd
==
FALSE
){
OutputsModel
<-
lapply
(
seq_len
(
RESULTS
$
NOutputs
),
function
(
i
)
RESULTS
$
Outputs
[
IndPeriod2
,
i
]);
...
...
R/RunModel_GR5J.R
View file @
5dce7a71
...
...
@@ -36,6 +36,11 @@ RunModel_GR5J <- function(InputsModel,RunOptions,Param){
if
(
"all"
%in%
RunOptions
$
Outputs_Sim
){
IndOutputs
<-
as.integer
(
1
:
length
(
FortranOutputs
));
}
else
{
IndOutputs
<-
which
(
FortranOutputs
%in%
RunOptions
$
Outputs_Sim
);
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##Use_of_IniResLevels
if
(
!
is.null
(
RunOptions
$
IniResLevels
)){
RunOptions
$
IniStates
[
1
]
<-
RunOptions
$
IniResLevels
[
1
]
*
Param
[
1
];
### production store level (mm)
...
...
@@ -60,16 +65,15 @@ RunModel_GR5J <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR5J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
NULL
,
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR5J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
NULL
,
UH1
=
NULL
,
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##OutputsModel_only
if
(
ExportDatesR
==
FALSE
&
ExportStateEnd
==
FALSE
){
OutputsModel
<-
lapply
(
seq_len
(
RESULTS
$
NOutputs
),
function
(
i
)
RESULTS
$
Outputs
[
IndPeriod2
,
i
]);
...
...
R/RunModel_GR6J.R
View file @
5dce7a71
...
...
@@ -40,6 +40,11 @@ RunModel_GR6J <- function(InputsModel,RunOptions,Param){
if
(
"all"
%in%
RunOptions
$
Outputs_Sim
){
IndOutputs
<-
as.integer
(
1
:
length
(
FortranOutputs
));
}
else
{
IndOutputs
<-
which
(
FortranOutputs
%in%
RunOptions
$
Outputs_Sim
);
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##Use_of_IniResLevels
if
(
!
is.null
(
RunOptions
$
IniResLevels
)){
RunOptions
$
IniStates
[
1
]
<-
RunOptions
$
IniResLevels
[
1
]
*
Param
[
1
];
### production store level (mm)
...
...
@@ -65,16 +70,15 @@ RunModel_GR6J <- function(InputsModel,RunOptions,Param){
)
RESULTS
$
Outputs
[
round
(
RESULTS
$
Outputs
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
[
round
(
RESULTS
$
StateEnd
,
3
)
==
(
-999.999
)]
<-
NA
;
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR6J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
RESULTS
$
StateEnd
[
3L
],
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
if
(
ExportStateEnd
)
{
RESULTS
$
StateEnd
<-
CreateIniStates
(
FUN_MOD
=
RunModel_GR6J
,
InputsModel
=
InputsModel
,
ProdStore
=
RESULTS
$
StateEnd
[
1L
],
RoutStore
=
RESULTS
$
StateEnd
[
2L
],
ExpStore
=
RESULTS
$
StateEnd
[
3L
],
UH1
=
RESULTS
$
StateEnd
[(
1
:
20
)
+7
],
UH2
=
RESULTS
$
StateEnd
[(
1
:
40
)
+
(
7+20
)],
GCemaNeigeLayers
=
NULL
,
eTGCemaNeigeLayers
=
NULL
,
verbose
=
FALSE
)
}
##Output_data_preparation
IndPeriod2
<-
(
length
(
RunOptions
$
IndPeriod_WarmUp
)
+1
)
:
LInputSeries
;
ExportDatesR
<-
"DatesR"
%in%
RunOptions
$
Outputs_Sim
;
ExportStateEnd
<-
"StateEnd"
%in%
RunOptions
$
Outputs_Sim
;
##OutputsModel_only
if
(
ExportDatesR
==
FALSE
&
ExportStateEnd
==
FALSE
){
OutputsModel
<-
lapply
(
seq_len
(
RESULTS
$
NOutputs
),
function
(
i
)
RESULTS
$
Outputs
[
IndPeriod2
,
i
]);
...
...
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