Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
NOCSurfaceProcesses
AirSeaFluxCode
Commits
5976a8b6
Commit
5976a8b6
authored
4 years ago
by
sbiri
Browse files
Options
Download
Email Patches
Plain Diff
C40 option removed
parent
391a1806
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
58 deletions
+41
-58
AirSeaFluxCode.py
AirSeaFluxCode.py
+11
-12
flux_subs.py
flux_subs.py
+15
-29
get_init.py
get_init.py
+10
-12
toy_ASFC.py
toy_ASFC.py
+5
-5
No files found.
AirSeaFluxCode.py
View file @
5976a8b6
...
@@ -58,7 +58,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
...
@@ -58,7 +58,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
default for UA, ecmwf [1, 1, 1000]
default for UA, ecmwf [1, 1, 1000]
default else [1, 1.2, 800]
default else [1, 1.2, 800]
meth : str
meth : str
"S80", "S88", "LP82", "YT96", "UA", "LY04", "C30", "C35",
"C40",
"S80", "S88", "LP82", "YT96", "UA", "LY04", "C30", "C35",
"ecmwf", "Beljaars"
"ecmwf", "Beljaars"
qmeth : str
qmeth : str
is the saturation evaporation method to use amongst
is the saturation evaporation method to use amongst
...
@@ -86,17 +86,17 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
...
@@ -86,17 +86,17 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
Returns
Returns
-------
-------
res : array that contains
res : array that contains
1. momentum flux (N/m^2)
1. momentum flux
(N/m^2)
2. sensible heat (W/m^2)
2. sensible heat
(W/m^2)
3. latent heat (W/m^2)
3. latent heat
(W/m^2)
4. Monin-Obhukov length (m
b
)
4. Monin-Obhukov length (m)
5. drag coefficient (cd)
5. drag coefficient (cd)
6. neutral drag coefficient (cdn)
6. neutral drag coefficient (cdn)
7. heat exhange coefficient (ct)
7. heat ex
c
hange coefficient (ct)
8. neutral heat exhange coefficient (ctn)
8. neutral heat ex
c
hange coefficient (ctn)
9. moisture exhange coefficient (cq)
9. moisture exhange coefficient (cq)
10. neutral moisture exhange coefficient (cqn)
10. neutral moisture ex
c
hange coefficient (cqn)
11. star virtual temperature (tsrv)
11. star virtual temperat
c
ure (tsrv)
12. star temperature (tsr)
12. star temperature (tsr)
13. star specific humidity (qsr)
13. star specific humidity (qsr)
14. star wind speed (usr)
14. star wind speed (usr)
...
@@ -110,7 +110,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
...
@@ -110,7 +110,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
22. surface roughness length (zo)
22. surface roughness length (zo)
23. heat roughness length (zot)
23. heat roughness length (zot)
24. moisture roughness length (zoq)
24. moisture roughness length (zoq)
25.
velocity
at reference height (uref)
25.
wind speed
at reference height (uref)
26. temperature at reference height (tref)
26. temperature at reference height (tref)
27. specific humidity at reference height (qref)
27. specific humidity at reference height (qref)
28. number of iterations until convergence
28. number of iterations until convergence
...
@@ -349,8 +349,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
...
@@ -349,8 +349,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
np
.
power
(
get_gust
(
gust
[
1
],
tv
[
ind
],
usr
[
ind
],
np
.
power
(
get_gust
(
gust
[
1
],
tv
[
ind
],
usr
[
ind
],
tsrv
[
ind
],
gust
[
2
],
lat
[
ind
]),
2
)))
tsrv
[
ind
],
gust
[
2
],
lat
[
ind
]),
2
)))
# Zeng et al. 1998 (20)
# Zeng et al. 1998 (20)
elif
(
gust
[
0
]
==
1
and
(
meth
==
"C30"
or
meth
==
"C35"
or
elif
(
gust
[
0
]
==
1
and
(
meth
==
"C30"
or
meth
==
"C35"
)):
meth
==
"C40"
)):
wind
[
ind
]
=
np
.
sqrt
(
np
.
power
(
np
.
copy
(
spd
[
ind
]),
2
)
+
wind
[
ind
]
=
np
.
sqrt
(
np
.
power
(
np
.
copy
(
spd
[
ind
]),
2
)
+
np
.
power
(
get_gust
(
gust
[
1
],
Ta
[
ind
],
usr
[
ind
],
np
.
power
(
get_gust
(
gust
[
1
],
Ta
[
ind
],
usr
[
ind
],
tsrv
[
ind
],
gust
[
2
],
lat
[
ind
]),
2
))
tsrv
[
ind
],
gust
[
2
],
lat
[
ind
]),
2
))
...
...
This diff is collapsed.
Click to expand it.
flux_subs.py
View file @
5976a8b6
...
@@ -6,7 +6,7 @@ from util_subs import (CtoK, kappa, gc, visc_air)
...
@@ -6,7 +6,7 @@ from util_subs import (CtoK, kappa, gc, visc_air)
def
cdn_calc
(
u10n
,
Ta
,
Tp
,
lat
,
meth
=
"S80"
):
def
cdn_calc
(
u10n
,
Ta
,
Tp
,
lat
,
meth
=
"S80"
):
"""
"""
Calculates
10m
neutral drag coefficient
Calculates neutral drag coefficient
Parameters
Parameters
----------
----------
...
@@ -33,7 +33,7 @@ def cdn_calc(u10n, Ta, Tp, lat, meth="S80"):
...
@@ -33,7 +33,7 @@ def cdn_calc(u10n, Ta, Tp, lat, meth="S80"):
np
.
where
((
u10n
<
11
)
&
(
u10n
>=
4
),
1.2
*
0.001
,
np
.
where
((
u10n
<
11
)
&
(
u10n
>=
4
),
1.2
*
0.001
,
(
0.49
+
0.065
*
u10n
)
*
0.001
))
(
0.49
+
0.065
*
u10n
)
*
0.001
))
elif
(
meth
==
"S88"
or
meth
==
"UA"
or
meth
==
"ecmwf"
or
meth
==
"C30"
or
elif
(
meth
==
"S88"
or
meth
==
"UA"
or
meth
==
"ecmwf"
or
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
or
meth
==
"Beljaars"
):
meth
==
"C35"
or
meth
==
"Beljaars"
):
cdn
=
cdn_from_roughness
(
u10n
,
Ta
,
None
,
lat
,
meth
)
cdn
=
cdn_from_roughness
(
u10n
,
Ta
,
None
,
lat
,
meth
)
elif
(
meth
==
"YT96"
):
elif
(
meth
==
"YT96"
):
# for u<3 YT96 convert usr in eq. 21 to cdn
# for u<3 YT96 convert usr in eq. 21 to cdn
...
@@ -56,7 +56,7 @@ def cdn_calc(u10n, Ta, Tp, lat, meth="S80"):
...
@@ -56,7 +56,7 @@ def cdn_calc(u10n, Ta, Tp, lat, meth="S80"):
def
cdn_from_roughness
(
u10n
,
Ta
,
Tp
,
lat
,
meth
=
"S88"
):
def
cdn_from_roughness
(
u10n
,
Ta
,
Tp
,
lat
,
meth
=
"S88"
):
"""
"""
Calculates
10m
neutral drag coefficient from roughness length
Calculates neutral drag coefficient from roughness length
Parameters
Parameters
----------
----------
...
@@ -99,10 +99,6 @@ def cdn_from_roughness(u10n, Ta, Tp, lat, meth="S88"):
...
@@ -99,10 +99,6 @@ def cdn_from_roughness(u10n, Ta, Tp, lat, meth="S88"):
a
=
0.011
*
np
.
ones
(
Ta
.
shape
)
a
=
0.011
*
np
.
ones
(
Ta
.
shape
)
a
=
np
.
where
(
u10n
>
19
,
0.0017
*
19
-
0.0050
,
0.0017
*
u10n
-
0.0050
)
a
=
np
.
where
(
u10n
>
19
,
0.0017
*
19
-
0.0050
,
0.0017
*
u10n
-
0.0050
)
zo
=
0.11
*
visc_air
(
Ta
)
/
usr
+
a
*
np
.
power
(
usr
,
2
)
/
g
zo
=
0.11
*
visc_air
(
Ta
)
/
usr
+
a
*
np
.
power
(
usr
,
2
)
/
g
elif
(
meth
==
"C40"
):
a
=
0.011
*
np
.
ones
(
Ta
.
shape
)
a
=
np
.
where
(
u10n
>
22
,
0.0016
*
22
-
0.0035
,
0.0016
*
u10n
-
0.0035
)
zo
=
a
*
np
.
power
(
usr
,
2
)
/
g
+
0.11
*
visc_air
(
Ta
)
/
usr
# surface roughness
elif
((
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
elif
((
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
# eq. (3.26) p.38 over sea IFS Documentation cy46r1
# eq. (3.26) p.38 over sea IFS Documentation cy46r1
zo
=
0.018
*
np
.
power
(
usr
,
2
)
/
g
+
0.11
*
visc_air
(
Ta
)
/
usr
zo
=
0.018
*
np
.
power
(
usr
,
2
)
/
g
+
0.11
*
visc_air
(
Ta
)
/
usr
...
@@ -140,7 +136,7 @@ def cd_calc(cdn, hin, hout, psim):
...
@@ -140,7 +136,7 @@ def cd_calc(cdn, hin, hout, psim):
def
ctcqn_calc
(
zol
,
cdn
,
u10n
,
zo
,
Ta
,
meth
=
"S80"
):
def
ctcqn_calc
(
zol
,
cdn
,
u10n
,
zo
,
Ta
,
meth
=
"S80"
):
"""
"""
Calculates
10m
neutral heat and moisture exchange coefficients
Calculates neutral heat and moisture exchange coefficients
Parameters
Parameters
----------
----------
...
@@ -198,16 +194,6 @@ def ctcqn_calc(zol, cdn, u10n, zo, Ta, meth="S80"):
...
@@ -198,16 +194,6 @@ def ctcqn_calc(zol, cdn, u10n, zo, Ta, meth="S80"):
zot
=
zoq
# temperature roughness
zot
=
zoq
# temperature roughness
cqn
=
kappa
**
2
/
np
.
log
(
10
/
zo
)
/
np
.
log
(
10
/
zoq
)
cqn
=
kappa
**
2
/
np
.
log
(
10
/
zo
)
/
np
.
log
(
10
/
zoq
)
ctn
=
kappa
**
2
/
np
.
log
(
10
/
zo
)
/
np
.
log
(
10
/
zot
)
ctn
=
kappa
**
2
/
np
.
log
(
10
/
zo
)
/
np
.
log
(
10
/
zot
)
elif
(
meth
==
"C40"
):
usr
=
np
.
sqrt
(
cdn
*
np
.
power
(
u10n
,
2
))
rr
=
zo
*
usr
/
visc_air
(
Ta
)
zot
=
np
.
where
(
1.0e-4
/
np
.
power
(
rr
,
0.55
)
>
2.4e-4
/
np
.
power
(
rr
,
1.2
),
2.4e-4
/
np
.
power
(
rr
,
1.2
),
1.0e-4
/
np
.
power
(
rr
,
0.55
))
# temperature roughness
zoq
=
np
.
where
(
2.0e-5
/
np
.
power
(
rr
,
0.22
)
>
1.1e-4
/
np
.
power
(
rr
,
0.9
),
1.1e-4
/
np
.
power
(
rr
,
0.9
),
2.0e-5
/
np
.
power
(
rr
,
0.22
))
cqn
=
kappa
**
2
/
np
.
log
(
10
/
zo
)
/
np
.
log
(
10
/
zoq
)
ctn
=
kappa
**
2
/
np
.
log
(
10
/
zo
)
/
np
.
log
(
10
/
zot
)
elif
(
meth
==
"ecmwf"
or
meth
==
"Beljaars"
):
elif
(
meth
==
"ecmwf"
or
meth
==
"Beljaars"
):
# eq. (3.26) p.38 over sea IFS Documentation cy46r1
# eq. (3.26) p.38 over sea IFS Documentation cy46r1
usr
=
np
.
sqrt
(
cdn
*
np
.
power
(
u10n
,
2
))
usr
=
np
.
sqrt
(
cdn
*
np
.
power
(
u10n
,
2
))
...
@@ -236,11 +222,11 @@ def ctcq_calc(cdn, cd, ctn, cqn, ht, hq, hout, psit, psiq):
...
@@ -236,11 +222,11 @@ def ctcq_calc(cdn, cd, ctn, cqn, ht, hq, hout, psit, psiq):
cqn : float
cqn : float
neutral moisture exchange coefficient
neutral moisture exchange coefficient
ht : float
ht : float
original temperature height [m]
original temperature
sensor
height [m]
hq : float
hq : float
original moisture height [m]
original moisture
sensor
height [m]
hout : float
hout : float
reference height [m]
reference height
[m]
psit : float
psit : float
heat stability function
heat stability function
psiq : float
psiq : float
...
@@ -276,7 +262,7 @@ def get_stabco(meth="S80"):
...
@@ -276,7 +262,7 @@ def get_stabco(meth="S80"):
alpha
,
beta
,
gamma
=
0
,
0
,
0
alpha
,
beta
,
gamma
=
0
,
0
,
0
if
(
meth
==
"S80"
or
meth
==
"S88"
or
meth
==
"LY04"
or
if
(
meth
==
"S80"
or
meth
==
"S88"
or
meth
==
"LY04"
or
meth
==
"UA"
or
meth
==
"ecmwf"
or
meth
==
"C30"
or
meth
==
"UA"
or
meth
==
"ecmwf"
or
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
or
meth
==
"Beljaars"
):
meth
==
"C35"
or
meth
==
"Beljaars"
):
alpha
,
beta
,
gamma
=
16
,
0.25
,
5
# Smith 1980, from Dyer (1974)
alpha
,
beta
,
gamma
=
16
,
0.25
,
5
# Smith 1980, from Dyer (1974)
elif
(
meth
==
"LP82"
):
elif
(
meth
==
"LP82"
):
alpha
,
beta
,
gamma
=
16
,
0.25
,
7
alpha
,
beta
,
gamma
=
16
,
0.25
,
7
...
@@ -308,7 +294,7 @@ def psim_calc(zol, meth="S80"):
...
@@ -308,7 +294,7 @@ def psim_calc(zol, meth="S80"):
"""
"""
if
(
meth
==
"ecmwf"
):
if
(
meth
==
"ecmwf"
):
psim
=
psim_ecmwf
(
zol
)
psim
=
psim_ecmwf
(
zol
)
elif
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
):
elif
(
meth
==
"C30"
or
meth
==
"C35"
):
#
or meth == "C40"
psim
=
psiu_26
(
zol
,
meth
)
psim
=
psiu_26
(
zol
,
meth
)
elif
(
meth
==
"Beljaars"
):
# Beljaars (1997) eq. 16, 17
elif
(
meth
==
"Beljaars"
):
# Beljaars (1997) eq. 16, 17
psim
=
np
.
where
(
zol
<
0
,
psim_conv
(
zol
,
meth
),
psi_Bel
(
zol
))
psim
=
np
.
where
(
zol
<
0
,
psim_conv
(
zol
,
meth
),
psi_Bel
(
zol
))
...
@@ -337,7 +323,7 @@ def psit_calc(zol, meth="S80"):
...
@@ -337,7 +323,7 @@ def psit_calc(zol, meth="S80"):
if
(
meth
==
"ecmwf"
):
if
(
meth
==
"ecmwf"
):
psit
=
np
.
where
(
zol
<
0
,
psi_conv
(
zol
,
meth
),
psit
=
np
.
where
(
zol
<
0
,
psi_conv
(
zol
,
meth
),
psi_ecmwf
(
zol
))
psi_ecmwf
(
zol
))
elif
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
):
elif
(
meth
==
"C30"
or
meth
==
"C35"
):
psit
=
psit_26
(
zol
)
psit
=
psit_26
(
zol
)
elif
(
meth
==
"Beljaars"
):
# Beljaars (1997) eq. 16, 17
elif
(
meth
==
"Beljaars"
):
# Beljaars (1997) eq. 16, 17
psit
=
np
.
where
(
zol
<
0
,
psi_conv
(
zol
,
meth
),
psi_Bel
(
zol
))
psit
=
np
.
where
(
zol
<
0
,
psi_conv
(
zol
,
meth
),
psi_Bel
(
zol
))
...
@@ -514,7 +500,7 @@ def psiu_26(zol, meth):
...
@@ -514,7 +500,7 @@ def psiu_26(zol, meth):
4
*
np
.
arctan
(
1
)
/
np
.
sqrt
(
3
),
np
.
nan
)
4
*
np
.
arctan
(
1
)
/
np
.
sqrt
(
3
),
np
.
nan
)
f
=
np
.
power
(
zol
,
2
)
/
(
1
+
np
.
power
(
zol
,
2
))
f
=
np
.
power
(
zol
,
2
)
/
(
1
+
np
.
power
(
zol
,
2
))
psi
=
np
.
where
(
zol
<
0
,
(
1
-
f
)
*
psik
+
f
*
psic
,
psi
)
psi
=
np
.
where
(
zol
<
0
,
(
1
-
f
)
*
psik
+
f
*
psic
,
psi
)
elif
(
meth
==
"C35"
or
meth
==
"C40"
):
elif
(
meth
==
"C35"
):
dzol
=
np
.
where
(
0.35
*
zol
>
50
,
50
,
0.35
*
zol
)
# stable
dzol
=
np
.
where
(
0.35
*
zol
>
50
,
50
,
0.35
*
zol
)
# stable
a
,
b
,
c
,
d
=
0.7
,
3
/
4
,
5
,
0.35
a
,
b
,
c
,
d
=
0.7
,
3
/
4
,
5
,
0.35
psi
=
np
.
where
(
zol
>
0
,
-
(
a
*
zol
+
b
*
(
zol
-
c
/
d
)
*
np
.
exp
(
-
dzol
)
+
b
*
c
/
d
),
psi
=
np
.
where
(
zol
>
0
,
-
(
a
*
zol
+
b
*
(
zol
-
c
/
d
)
*
np
.
exp
(
-
dzol
)
+
b
*
c
/
d
),
...
@@ -949,7 +935,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, psim,
...
@@ -949,7 +935,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, psim,
Monin-Obukhov length from previous iteration step (m)
Monin-Obukhov length from previous iteration step (m)
meth : str
meth : str
bulk parameterisation method option: "S80", "S88", "LP82", "YT96",
bulk parameterisation method option: "S80", "S88", "LP82", "YT96",
"UA", "LY04", "C30", "C35",
"C40",
"ecmwf", "Beljaars"
"UA", "LY04", "C30", "C35", "ecmwf", "Beljaars"
Returns
Returns
-------
-------
...
@@ -988,7 +974,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, psim,
...
@@ -988,7 +974,7 @@ def get_L(L, lat, usr, tsr, qsr, hin, Ta, sst, qair, qsea, wind, monob, psim,
(
np
.
log
((
hin
[
1
]
+
zo
)
/
zot
)
-
(
np
.
log
((
hin
[
1
]
+
zo
)
/
zot
)
-
psit_calc
((
hin
[
1
]
+
zo
)
/
monob
,
meth
)
+
psit_calc
((
hin
[
1
]
+
zo
)
/
monob
,
meth
)
+
psit_calc
(
zot
/
monob
,
meth
))))
psit_calc
(
zot
/
monob
,
meth
))))
monob
=
hin
[
1
]
/
zol
monob
=
hin
[
1
]
/
zol
return
tsrv
,
monob
,
Rb
return
tsrv
,
monob
,
Rb
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
...
@@ -1032,7 +1018,7 @@ def get_strs(hin, monob, wind, zo, zot, zoq, dt, dq, dter, dqer, dtwl, ct, cq,
...
@@ -1032,7 +1018,7 @@ def get_strs(hin, monob, wind, zo, zot, zoq, dt, dq, dter, dqer, dtwl, ct, cq,
warm layer correction switch
warm layer correction switch
meth : str
meth : str
bulk parameterisation method option: "S80", "S88", "LP82", "YT96", "UA",
bulk parameterisation method option: "S80", "S88", "LP82", "YT96", "UA",
"LY04", "C30", "C35",
"C40",
"ecmwf", "Beljaars"
"LY04", "C30", "C35", "ecmwf", "Beljaars"
Returns
Returns
-------
-------
...
@@ -1096,7 +1082,7 @@ def get_strs(hin, monob, wind, zo, zot, zoq, dt, dq, dter, dqer, dtwl, ct, cq,
...
@@ -1096,7 +1082,7 @@ def get_strs(hin, monob, wind, zo, zot, zoq, dt, dq, dter, dqer, dtwl, ct, cq,
(
np
.
log
(
monob
/
zoq
)
+
5
-
5
*
zoq
/
monob
+
(
np
.
log
(
monob
/
zoq
)
+
5
-
5
*
zoq
/
monob
+
5
*
np
.
log
(
hin
[
2
]
/
monob
)
+
5
*
np
.
log
(
hin
[
2
]
/
monob
)
+
hin
[
2
]
/
monob
-
1
))))
hin
[
2
]
/
monob
-
1
))))
elif
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
):
elif
(
meth
==
"C30"
or
meth
==
"C35"
):
usr
=
(
wind
*
kappa
/
(
np
.
log
(
hin
[
0
]
/
zo
)
-
psiu_26
(
hin
[
0
]
/
monob
,
meth
)))
usr
=
(
wind
*
kappa
/
(
np
.
log
(
hin
[
0
]
/
zo
)
-
psiu_26
(
hin
[
0
]
/
monob
,
meth
)))
tsr
=
((
dt
+
dter
*
cskin
-
dtwl
*
wl
)
*
(
kappa
/
(
np
.
log
(
hin
[
1
]
/
zot
)
-
tsr
=
((
dt
+
dter
*
cskin
-
dtwl
*
wl
)
*
(
kappa
/
(
np
.
log
(
hin
[
1
]
/
zot
)
-
psit_26
(
hin
[
1
]
/
monob
))))
psit_26
(
hin
[
1
]
/
monob
))))
...
...
This diff is collapsed.
Click to expand it.
get_init.py
View file @
5976a8b6
import
numpy
as
np
import
numpy
as
np
import
sys
import
sys
def
get_init
(
spd
,
T
,
SST
,
lat
,
hum
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
L
,
tol
,
meth
,
def
get_init
(
spd
,
T
,
SST
,
lat
,
hum
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
L
,
tol
,
qmeth
):
meth
,
qmeth
):
"""
"""
Checks initial input values and sets defaults if needed
Checks initial input values and sets defaults if needed
...
@@ -17,7 +17,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
...
@@ -17,7 +17,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
sea surface temperature in K
sea surface temperature in K
lat : float
lat : float
latitude (deg), default 45deg
latitude (deg), default 45deg
hum :
float
hum :
array
relative humidity, if None is set to 80%
relative humidity, if None is set to 80%
P : float
P : float
air pressure (hPa), default 1013hPa
air pressure (hPa), default 1013hPa
...
@@ -40,14 +40,14 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
...
@@ -40,14 +40,14 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
default else [1, 1.2, 800]
default else [1, 1.2, 800]
L : int
L : int
Monin-Obukhov length definition options
Monin-Obukhov length definition options
tol :
float
tol :
array
4x1 or 7x1 [option, lim1-3 or lim1-6]
4x1 or 7x1 [option, lim1-3 or lim1-6]
option : 'flux' to set tolerance limits for fluxes only lim1-3
option : 'flux' to set tolerance limits for fluxes only lim1-3
option : 'ref' to set tolerance limits for height adjustment lim-1-3
option : 'ref' to set tolerance limits for height adjustment lim-1-3
option : 'all' to set tolerance limits for both fluxes and height
option : 'all' to set tolerance limits for both fluxes and height
adjustment lim1-6 ['all', 0.01, 0.01, 5e-05, 1e-3, 0.1, 0.1]
adjustment lim1-6 ['all', 0.01, 0.01, 5e-05, 1e-3, 0.1, 0.1]
meth : str
meth : str
"S80","S88","LP82","YT96","UA","LY04","C30","C35","
C40","
ecmwf",
"S80","S88","LP82","YT96","UA","LY04","C30","C35","ecmwf",
"Beljaars"
"Beljaars"
qmeth : str
qmeth : str
is the saturation evaporation method to use amongst
is the saturation evaporation method to use amongst
...
@@ -90,7 +90,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
...
@@ -90,7 +90,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
sys
.
exit
(
"input dtype of spd, T and SST should be float"
)
sys
.
exit
(
"input dtype of spd, T and SST should be float"
)
# if input values are nan break
# if input values are nan break
if
meth
not
in
[
"S80"
,
"S88"
,
"LP82"
,
"YT96"
,
"UA"
,
"LY04"
,
"C30"
,
"C35"
,
if
meth
not
in
[
"S80"
,
"S88"
,
"LP82"
,
"YT96"
,
"UA"
,
"LY04"
,
"C30"
,
"C35"
,
"C40"
,
"ecmwf"
,
"Beljaars"
]:
"ecmwf"
,
"Beljaars"
]:
sys
.
exit
(
"unknown method"
)
sys
.
exit
(
"unknown method"
)
if
qmeth
not
in
[
"HylandWexler"
,
"Hardy"
,
"Preining"
,
"Wexler"
,
if
qmeth
not
in
[
"HylandWexler"
,
"Hardy"
,
"Preining"
,
"Wexler"
,
"GoffGratch"
,
"WMO"
,
"MagnusTetens"
,
"Buck"
,
"Buck2"
,
"GoffGratch"
,
"WMO"
,
"MagnusTetens"
,
"Buck"
,
"Buck2"
,
...
@@ -119,11 +119,10 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
...
@@ -119,11 +119,10 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
or
meth
==
"YT96"
or
meth
==
"UA"
or
or
meth
==
"YT96"
or
meth
==
"UA"
or
meth
==
"LY04"
)):
meth
==
"LY04"
)):
cskin
=
0
cskin
=
0
elif
((
cskin
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
elif
((
cskin
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
or
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
cskin
=
1
cskin
=
1
if
((
skin
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
if
((
skin
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
)):
or
meth
==
"C40"
)):
skin
=
"C35"
skin
=
"C35"
elif
((
skin
==
None
)
and
(
meth
==
"ecmwf"
)):
elif
((
skin
==
None
)
and
(
meth
==
"ecmwf"
)):
skin
=
"ecmwf"
skin
=
"ecmwf"
...
@@ -131,8 +130,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
...
@@ -131,8 +130,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
skin
=
"Beljaars"
skin
=
"Beljaars"
if
(
wl
==
None
):
if
(
wl
==
None
):
wl
=
0
wl
=
0
if
(
np
.
all
(
gust
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
if
(
np
.
all
(
gust
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
)):
meth
==
"C40"
)):
gust
=
[
1
,
1.2
,
600
]
gust
=
[
1
,
1.2
,
600
]
elif
(
np
.
all
(
gust
==
None
)
and
(
meth
==
"UA"
or
meth
==
"ecmwf"
or
elif
(
np
.
all
(
gust
==
None
)
and
(
meth
==
"UA"
or
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
meth
==
"Beljaars"
)):
...
@@ -148,7 +146,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
...
@@ -148,7 +146,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol, me
if
((
L
==
None
)
and
(
meth
==
"S80"
or
meth
==
"S88"
or
meth
==
"LP82"
if
((
L
==
None
)
and
(
meth
==
"S80"
or
meth
==
"S88"
or
meth
==
"LP82"
or
meth
==
"YT96"
or
meth
==
"LY04"
or
or
meth
==
"YT96"
or
meth
==
"LY04"
or
meth
==
"UA"
or
meth
==
"C30"
or
meth
==
"C35"
meth
==
"UA"
or
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
or
meth
==
"Beljaars"
)):
or
meth
==
"Beljaars"
)):
L
=
"S80"
L
=
"S80"
elif
((
L
==
None
)
and
(
meth
==
"ecmwf"
)):
elif
((
L
==
None
)
and
(
meth
==
"ecmwf"
)):
L
=
"ecmwf"
L
=
"ecmwf"
...
...
This diff is collapsed.
Click to expand it.
toy_ASFC.py
View file @
5976a8b6
...
@@ -493,7 +493,7 @@ start_time = time.perf_counter()
...
@@ -493,7 +493,7 @@ start_time = time.perf_counter()
inF
=
input
(
"Give input file name (data_all.csv or era5_r360x180.nc):
\n
"
)
inF
=
input
(
"Give input file name (data_all.csv or era5_r360x180.nc):
\n
"
)
meth
=
input
(
"Give prefered method:
\n
"
)
meth
=
input
(
"Give prefered method:
\n
"
)
while
meth
not
in
[
"S80"
,
"S88"
,
"LP82"
,
"YT96"
,
"UA"
,
"LY04"
,
"C30"
,
"C35"
,
while
meth
not
in
[
"S80"
,
"S88"
,
"LP82"
,
"YT96"
,
"UA"
,
"LY04"
,
"C30"
,
"C35"
,
"C40"
,
"ecmwf"
,
"Beljaars"
]:
"ecmwf"
,
"Beljaars"
]:
print
(
"method unknown"
)
print
(
"method unknown"
)
meth
=
input
(
"Give prefered method:
\n
"
)
meth
=
input
(
"Give prefered method:
\n
"
)
else
:
else
:
...
@@ -519,8 +519,8 @@ if (cskinIn == ''):
...
@@ -519,8 +519,8 @@ if (cskinIn == ''):
meth
==
"LY04"
)):
meth
==
"LY04"
)):
cskinIn
=
0
cskinIn
=
0
ext
=
ext
+
'noskin_'
ext
=
ext
+
'noskin_'
elif
((
cskinIn
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
elif
((
cskinIn
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
or
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
cskinIn
=
1
cskinIn
=
1
ext
=
ext
+
'skin_'
ext
=
ext
+
'skin_'
else
:
else
:
...
@@ -589,10 +589,10 @@ if ((cskinIn == None) and (meth == "S80" or meth == "S88" or meth == "LP82"
...
@@ -589,10 +589,10 @@ if ((cskinIn == None) and (meth == "S80" or meth == "S88" or meth == "LP82"
or
meth
==
"YT96"
or
meth
==
"UA"
or
or
meth
==
"YT96"
or
meth
==
"UA"
or
meth
==
"LY04"
)):
meth
==
"LY04"
)):
cskinIn
=
0
cskinIn
=
0
elif
((
cskinIn
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
elif
((
cskinIn
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
or
meth
==
"ecmwf"
or
meth
==
"Beljaars"
)):
cskinIn
=
1
cskinIn
=
1
if
(
np
.
all
(
gustIn
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
or
meth
==
"C40"
)):
if
(
np
.
all
(
gustIn
==
None
)
and
(
meth
==
"C30"
or
meth
==
"C35"
)):
gustIn
=
[
1
,
1.2
,
600
]
gustIn
=
[
1
,
1.2
,
600
]
elif
(
np
.
all
(
gustIn
==
None
)
and
(
meth
==
"UA"
or
meth
==
"ecmwf"
)):
elif
(
np
.
all
(
gustIn
==
None
)
and
(
meth
==
"UA"
or
meth
==
"ecmwf"
)):
gustIn
=
[
1
,
1
,
1000
]
gustIn
=
[
1
,
1
,
1000
]
...
...
This diff is collapsed.
Click to expand it.
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