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
977eb64b
Commit
977eb64b
authored
Feb 16, 2017
by
unknown
Browse files
v1.0.5.21 function TransfoParam_GR2M() cleaned
parent
ef08ae63
Changes
2
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
977eb64b
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.0.5.2
0
Date: 2017-0
1-23
Version: 1.0.5.2
1
Date: 2017-0
2-16
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")),
person("Charles", "Perrin", role = c("aut", "ths")),
...
...
R/TransfoParam_GR2M.R
View file @
977eb64b
TransfoParam_GR2M
<-
function
(
ParamIn
,
Direction
){
NParam
<-
2
;
Bool
<-
is.matrix
(
ParamIn
);
if
(
Bool
==
FALSE
){
ParamIn
<-
rbind
(
ParamIn
);
}
if
(
ncol
(
ParamIn
)
!=
NParam
){
stop
(
paste
(
"the GR2M model requires "
,
NParam
,
" parameters \n"
,
sep
=
""
));
return
(
NULL
);
}
if
(
Direction
==
"TR"
){
ParamOut
<-
ParamIn
;
ParamOut
[,
1
]
<-
exp
(
ParamIn
[,
1
]);
ParamOut
[,
2
]
<-
ParamIn
[,
2
]
/
4
+
2.5
;
}
if
(
Direction
==
"RT"
){
ParamOut
<-
ParamIn
;
ParamOut
[,
1
]
<-
log
(
ParamIn
[,
1
]);
ParamOut
[,
2
]
<-
(
ParamIn
[,
2
]
-
2.5
)
*
4
;
}
if
(
Bool
==
FALSE
){
ParamOut
<-
ParamOut
[
1
,];
}
return
(
ParamOut
);
TransfoParam_GR2M
<-
function
(
ParamIn
,
Direction
)
{
NParam
<-
2
Bool
<-
is.matrix
(
ParamIn
)
if
(
Bool
==
FALSE
)
{
ParamIn
<-
rbind
(
ParamIn
)
}
if
(
ncol
(
ParamIn
)
!=
NParam
)
{
stop
(
paste
(
"the GR2M model requires "
,
NParam
,
" parameters \n"
,
sep
=
""
))
return
(
NULL
)
}
if
(
Direction
==
"TR"
)
{
ParamOut
<-
ParamIn
ParamOut
[,
1
]
<-
exp
(
ParamIn
[,
1
])
ParamOut
[,
2
]
<-
ParamIn
[,
2
]
/
4
+
2.5
}
if
(
Direction
==
"RT"
)
{
ParamOut
<-
ParamIn
ParamOut
[,
1
]
<-
log
(
ParamIn
[,
1
])
ParamOut
[,
2
]
<-
(
ParamIn
[,
2
]
-
2.5
)
*
4
}
if
(
Bool
==
FALSE
)
{
ParamOut
<-
ParamOut
[
1
,
]
}
return
(
ParamOut
)
}
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