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
7175007b
Commit
7175007b
authored
Mar 13, 2019
by
Delaigue Olivier
Browse files
v1.2.9.8 CLEAN: syntax revision of TransfoParam_GR6J
parent
52d20262
Changes
3
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
7175007b
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.2.9.
7
Version: 1.2.9.
8
Date: 2019-03-13
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
...
...
NEWS.rmd
View file @
7175007b
...
...
@@ -13,7 +13,7 @@ output:
### 1.2.9.
7
Release Notes (2019-03-13)
### 1.2.9.
8
Release Notes (2019-03-13)
...
...
R/TransfoParam_GR6J.R
View file @
7175007b
TransfoParam_GR6J
<-
function
(
ParamIn
,
Direction
){
NParam
<-
6
;
Bool
<-
is.matrix
(
ParamIn
);
if
(
Bool
==
FALSE
){
ParamIn
<-
rbind
(
ParamIn
);
}
if
(
ncol
(
ParamIn
)
!=
NParam
){
stop
(
paste
(
"the GR6J model requires "
,
NParam
,
" parameters"
,
sep
=
""
))
}
if
(
Direction
==
"TR"
){
ParamOut
<-
ParamIn
;
ParamOut
[,
1
]
<-
exp
(
ParamIn
[,
1
]);
### GR6J X1 (production store capacity)
ParamOut
[,
2
]
<-
sinh
(
ParamIn
[,
2
]);
### GR6J X2 (groundwater exchange coefficient 1)
ParamOut
[,
3
]
<-
exp
(
ParamIn
[,
3
]);
### GR6J X3 (routing store capacity)
ParamOut
[,
4
]
<-
20+19.5
*
(
ParamIn
[,
4
]
-9.99
)
/
19.98
;
### GR6J X4 (unit hydrograph time constant)
ParamOut
[,
5
]
<-
ParamIn
[,
5
]
/
5
.
;
### GR5J X5 (groundwater exchange coefficient 2)
ParamOut
[,
6
]
<-
exp
(
ParamIn
[,
6
]);
### GR6J X6 (coefficient for emptying exponential store)
}
if
(
Direction
==
"RT"
){
ParamOut
<-
ParamIn
;
ParamOut
[,
1
]
<-
log
(
ParamIn
[,
1
]);
### GR6J X1 (production store capacity)
ParamOut
[,
2
]
<-
asinh
(
ParamIn
[,
2
]);
### GR6J X2 (groundwater exchange coefficient 1)
ParamOut
[,
3
]
<-
log
(
ParamIn
[,
3
]);
### GR6J X3 (routing store capacity)
ParamOut
[,
4
]
<-
9.99+19.98
*
(
ParamIn
[,
4
]
-20
)
/
19.5
;
### GR6J X4 (unit hydrograph time constant)
ParamOut
[,
5
]
<-
ParamIn
[,
5
]
*
5
.
;
### GR5J X5 (groundwater exchange coefficient 2)
ParamOut
[,
6
]
<-
log
(
ParamIn
[,
6
]);
### GR6J X6 (coefficient for emptying exponential store)
}
if
(
Bool
==
FALSE
){
ParamOut
<-
ParamOut
[
1
,];
}
return
(
ParamOut
);
TransfoParam_GR6J
<-
function
(
ParamIn
,
Direction
)
{
NParam
<-
6
Bool
<-
is.matrix
(
ParamIn
)
if
(
Bool
==
FALSE
)
{
ParamIn
<-
rbind
(
ParamIn
)
}
if
(
ncol
(
ParamIn
)
!=
NParam
)
{
stop
(
sprintf
(
"the GR6J model requires %i parameters"
,
NParam
))
}
if
(
Direction
==
"TR"
)
{
ParamOut
<-
ParamIn
ParamOut
[,
1
]
<-
exp
(
ParamIn
[,
1
])
### GR6J X1 (production store capacity)
ParamOut
[,
2
]
<-
sinh
(
ParamIn
[,
2
])
### GR6J X2 (groundwater exchange coefficient 1)
ParamOut
[,
3
]
<-
exp
(
ParamIn
[,
3
])
### GR6J X3 (routing store capacity)
ParamOut
[,
4
]
<-
20
+
19.5
*
(
ParamIn
[,
4
]
-
9.99
)
/
19.98
### GR6J X4 (unit hydrograph time constant)
ParamOut
[,
5
]
<-
ParamIn
[,
5
]
/
5
.
### GR5J X5 (groundwater exchange coefficient 2)
ParamOut
[,
6
]
<-
exp
(
ParamIn
[,
6
])
### GR6J X6 (coefficient for emptying exponential store)
}
if
(
Direction
==
"RT"
)
{
ParamOut
<-
ParamIn
ParamOut
[,
1
]
<-
log
(
ParamIn
[,
1
])
### GR6J X1 (production store capacity)
ParamOut
[,
2
]
<-
asinh
(
ParamIn
[,
2
])
### GR6J X2 (groundwater exchange coefficient 1)
ParamOut
[,
3
]
<-
log
(
ParamIn
[,
3
])
### GR6J X3 (routing store capacity)
ParamOut
[,
4
]
<-
9.99
+
19.98
*
(
ParamIn
[,
4
]
-
20
)
/
19.5
### GR6J X4 (unit hydrograph time constant)
ParamOut
[,
5
]
<-
ParamIn
[,
5
]
*
5
.
### GR5J X5 (groundwater exchange coefficient 2)
ParamOut
[,
6
]
<-
log
(
ParamIn
[,
6
])
### GR6J X6 (coefficient for emptying exponential store)
}
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