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
cbb47e9f
Commit
cbb47e9f
authored
Oct 16, 2020
by
Delaigue Olivier
Browse files
v1.6.3.18 style: minor typo revision, code indented and comment removed in PE_Oudin
parent
e3b33142
Pipeline
#16702
passed with stages
in 11 minutes and 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
cbb47e9f
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.3.1
7
Date: 2020-10-1
5
Version: 1.6.3.1
8
Date: 2020-10-1
6
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"),
...
...
NEWS.md
View file @
cbb47e9f
...
...
@@ -2,7 +2,7 @@
### 1.6.3.1
7
Release Notes (2020-10-1
5
)
### 1.6.3.1
8
Release Notes (2020-10-1
6
)
#### New features
...
...
R/PE_Oudin.R
View file @
cbb47e9f
...
...
@@ -6,12 +6,6 @@ PE_Oudin <- function(JD, Temp,
## ---------- check arguments
# if (!missing(LatRad)) {
# warning("Deprecated 'LatRad' argument. Please, use 'Lat' instead.")
# if (missing(Lat)) {
# Lat <- LatRad
# }
# }
if
(
!
(
inherits
(
JD
,
"numeric"
)
|
inherits
(
JD
,
"integer"
)))
{
stop
(
"'JD' must be of class 'numeric'"
)
}
...
...
@@ -21,7 +15,6 @@ PE_Oudin <- function(JD, Temp,
if
(
length
(
JD
)
!=
length
(
Temp
))
{
stop
(
"'JD' and 'Temp' must have the same length"
)
}
if
(
!
RunFortran
&
(
!
inherits
(
Lat
,
"numeric"
)
|
length
(
Lat
)
!=
1
))
{
stop
(
"'Lat' must be a 'numeric' of length one"
)
}
...
...
@@ -67,8 +60,7 @@ PE_Oudin <- function(JD, Temp,
## ---------- Oudin's formula
if
(
RunFortran
)
{
if
(
RunFortran
)
{
if
(
LatUnit
[
1L
]
==
"rad"
)
{
Lat
=
Lat
*
180
/
pi
}
...
...
@@ -79,7 +71,7 @@ PE_Oudin <- function(JD, Temp,
Lat
=
rep
(
Lat
,
LInputs
)
}
RESULTS
<-
.Fortran
(
"frun_etp_oudin"
,
PACKAGE
=
"airGR"
,
RESULTS
<-
.Fortran
(
"frun_etp_oudin"
,
PACKAGE
=
"airGR"
,
##inputs
LInputs
=
LInputs
,
InputsLAT
=
as.double
(
Lat
),
...
...
@@ -92,57 +84,57 @@ PE_Oudin <- function(JD, Temp,
}
else
{
PE_Oudin_D
<-
rep
(
NA
,
length
(
Temp
))
COSFI
<-
cos
(
FI
)
AFI
<-
abs
(
FI
/
42
)
for
(
k
in
seq_along
(
Temp
))
{
TETA
<-
0.4093
*
sin
(
JD
[
k
]
/
58.1
-
1.405
)
COSTETA
<-
cos
(
TETA
)
COSGZ
<-
max
(
0.001
,
cos
(
FI
-
TETA
))
GZ
<-
acos
(
COSGZ
)
COSOM
<-
1
-
COSGZ
/
COSFI
/
COSTETA
if
(
COSOM
<
-1
)
{
COSOM
<-
-1
}
if
(
COSOM
>
1
)
{
COSOM
<-
1
}
COSOM2
<-
COSOM
*
COSOM
PE_Oudin_D
<-
rep
(
NA
,
length
(
Temp
))
COSFI
<-
cos
(
FI
)
AFI
<-
abs
(
FI
/
42
)
if
(
COSOM2
>=
1
)
{
SINOM
<-
0
}
else
{
SINOM
<-
sqrt
(
1
-
COSOM2
)
}
OM
<-
acos
(
COSOM
)
COSPZ
<-
COSGZ
+
COSFI
*
COSTETA
*
(
SINOM
/
OM
-
1
)
if
(
COSPZ
<
0.001
)
{
COSPZ
<-
0.001
}
ETA
<-
1
+
cos
(
JD
[
k
]
/
58.1
)
/
30
GE
<-
446
*
OM
*
COSPZ
*
ETA
if
(
is.na
(
Temp
[
k
]))
{
PE_Oudin_D
[
k
]
<-
NA
}
else
{
if
(
Temp
[
k
]
>=
-5.0
)
{
PE_Oudin_D
[
k
]
<-
GE
*
(
Temp
[
k
]
+
5
)
/
100
/
28.5
for
(
k
in
seq_along
(
Temp
))
{
TETA
<-
0.4093
*
sin
(
JD
[
k
]
/
58.1
-
1.405
)
COSTETA
<-
cos
(
TETA
)
COSGZ
<-
max
(
0.001
,
cos
(
FI
-
TETA
))
GZ
<-
acos
(
COSGZ
)
COSOM
<-
1
-
COSGZ
/
COSFI
/
COSTETA
if
(
COSOM
<
-1
)
{
COSOM
<-
-1
}
if
(
COSOM
>
1
)
{
COSOM
<-
1
}
COSOM2
<-
COSOM
*
COSOM
if
(
COSOM2
>=
1
)
{
SINOM
<-
0
}
else
{
PE_Oudin_D
[
k
]
<-
0
SINOM
<-
sqrt
(
1
-
COSOM2
)
}
OM
<-
acos
(
COSOM
)
COSPZ
<-
COSGZ
+
COSFI
*
COSTETA
*
(
SINOM
/
OM
-
1
)
if
(
COSPZ
<
0.001
)
{
COSPZ
<-
0.001
}
ETA
<-
1
+
cos
(
JD
[
k
]
/
58.1
)
/
30
GE
<-
446
*
OM
*
COSPZ
*
ETA
if
(
is.na
(
Temp
[
k
]))
{
PE_Oudin_D
[
k
]
<-
NA
}
else
{
if
(
Temp
[
k
]
>=
-5.0
)
{
PE_Oudin_D
[
k
]
<-
GE
*
(
Temp
[
k
]
+
5
)
/
100
/
28.5
}
else
{
PE_Oudin_D
[
k
]
<-
0
}
}
}
}
}
## ---------- disaggregate PE from daily to hourly
if
(
TimeStepOut
==
"hourly"
)
{
...
...
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