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
1842c90c
Commit
1842c90c
authored
Jan 18, 2017
by
unknown
Browse files
v1.0.4.3 in Calibration_Michel(), the function creating the grid of parameters has been simplified
parent
41bf02dd
Changes
2
Show whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
1842c90c
Package: airGR
Type: Package
Title: Suite of GR hydrological models for precipitation-runoff modelling
Version: 1.0.4.
2
Version: 1.0.4.
3
Date: 2017-01-18
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")),
...
...
R/Calibration_Michel.R
View file @
1842c90c
...
...
@@ -119,40 +119,7 @@ Calibration_Michel <- function(InputsModel, RunOptions, InputsCrit, CalibOptions
##Definition_of_the_function_creating_all_possible_parameter_sets_from_different_values_for_each_parameter
ProposeCandidatesGrid
<-
function
(
DistribParam
)
{
##Managing_matrix_sizes
Nvalmax
<-
nrow
(
DistribParam
)
NParam
<-
ncol
(
DistribParam
)
##we_add_columns_to_MatDistrib_until_it_has_20_columns
DistribParam2
<-
matrix
(
NA
,
nrow
=
Nvalmax
,
ncol
=
20
)
DistribParam2
[
1
:
Nvalmax
,
1
:
NParam
]
<-
DistribParam
##we_check_the_number_of_values_to_test_for_each_param
NbDistrib
<-
rep
(
1
,
20
)
for
(
iC
in
1
:
20
)
{
NbDistrib
[
iC
]
<-
max
(
1
,
Nvalmax
-
sum
(
is.na
(
DistribParam2
[,
iC
])))
}
##Loop_on_the_various_values_to_test ###(if 4 param and 3 values for each => 3^4 sets)
##NB_we_always_do_20_loops ###which_is_here_the_max_number_of_param_that_can_be_optimised
VECT
<-
NULL
for
(
iL01
in
1
:
NbDistrib
[
01
])
{
for
(
iL02
in
1
:
NbDistrib
[
02
])
{
for
(
iL03
in
1
:
NbDistrib
[
03
])
{
for
(
iL04
in
1
:
NbDistrib
[
04
])
{
for
(
iL05
in
1
:
NbDistrib
[
05
])
{
for
(
iL06
in
1
:
NbDistrib
[
06
])
{
for
(
iL07
in
1
:
NbDistrib
[
07
])
{
for
(
iL08
in
1
:
NbDistrib
[
08
])
{
for
(
iL09
in
1
:
NbDistrib
[
09
])
{
for
(
iL10
in
1
:
NbDistrib
[
10
])
{
for
(
iL11
in
1
:
NbDistrib
[
11
])
{
for
(
iL12
in
1
:
NbDistrib
[
12
])
{
for
(
iL13
in
1
:
NbDistrib
[
13
])
{
for
(
iL14
in
1
:
NbDistrib
[
14
])
{
for
(
iL15
in
1
:
NbDistrib
[
15
])
{
for
(
iL16
in
1
:
NbDistrib
[
16
])
{
for
(
iL17
in
1
:
NbDistrib
[
17
])
{
for
(
iL18
in
1
:
NbDistrib
[
18
])
{
for
(
iL19
in
1
:
NbDistrib
[
19
])
{
for
(
iL20
in
1
:
NbDistrib
[
20
])
{
VECT
<-
c
(
VECT
,
DistribParam2
[
iL01
,
01
],
DistribParam2
[
iL02
,
02
],
DistribParam2
[
iL03
,
03
],
DistribParam2
[
iL04
,
04
],
DistribParam2
[
iL05
,
05
],
DistribParam2
[
iL06
,
06
],
DistribParam2
[
iL07
,
07
],
DistribParam2
[
iL08
,
08
],
DistribParam2
[
iL09
,
09
],
DistribParam2
[
iL10
,
10
],
DistribParam2
[
iL11
,
11
],
DistribParam2
[
iL12
,
12
],
DistribParam2
[
iL13
,
13
],
DistribParam2
[
iL14
,
14
],
DistribParam2
[
iL15
,
15
],
DistribParam2
[
iL16
,
16
],
DistribParam2
[
iL17
,
17
],
DistribParam2
[
iL18
,
18
],
DistribParam2
[
iL19
,
19
],
DistribParam2
[
iL20
,
20
])
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
MAT
<-
matrix
(
VECT
,
ncol
=
20
,
byrow
=
TRUE
)[,
1
:
NParam
]
if
(
!
is.matrix
(
MAT
))
{
MAT
<-
cbind
(
MAT
)
}
Output
<-
NULL
Output
$
NewCandidates
<-
MAT
return
(
Output
)
Output
<-
list
(
NewCandidates
=
expand.grid
(
lapply
(
seq_len
(
ncol
(
DistribParamR
)),
function
(
x
)
DistribParam
[,
x
])))
}
...
...
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