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
9bda0f47
Commit
9bda0f47
authored
4 years ago
by
sbiri
Browse files
Options
Download
Email Patches
Plain Diff
- removed restriction for rh > 100 to lead to NaN
- set default method S88
parent
3e398349
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
AirSeaFluxCode.py
AirSeaFluxCode.py
+3
-4
hum_subs.py
hum_subs.py
+2
-2
No files found.
AirSeaFluxCode.py
View file @
9bda0f47
...
...
@@ -12,7 +12,7 @@ from flux_subs import (cs_C35, cs_Beljaars, cs_ecmwf, wl_ecmwf,
def
AirSeaFluxCode
(
spd
,
T
,
SST
,
lat
=
None
,
hum
=
None
,
P
=
None
,
hin
=
18
,
hout
=
10
,
Rl
=
None
,
Rs
=
None
,
cskin
=
None
,
skin
=
"C35"
,
wl
=
0
,
gust
=
None
,
meth
=
"S8
0
"
,
qmeth
=
"Buck2"
,
tol
=
None
,
n
=
10
,
out
=
0
,
L
=
None
):
meth
=
"S8
8
"
,
qmeth
=
"Buck2"
,
tol
=
None
,
n
=
10
,
out
=
0
,
L
=
None
):
"""
Calculates turbulent surface fluxes using different parameterizations
Calculates height adjusted values for spd, T, q
...
...
@@ -379,7 +379,6 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
wind
[
ind
]
=
np
.
copy
(
spd
[
ind
])
u10n
[
ind
]
=
wind
[
ind
]
-
usr
[
ind
]
/
kappa
*
(
np
.
log
(
h_in
[
0
,
ind
]
/
10
)
-
psim
[
ind
])
# usr[ind]/np.sqrt(cd10n[ind])
if
(
it
<
4
):
# make sure you allow small negative values convergence
u10n
=
np
.
where
(
u10n
<
0
,
0.5
,
u10n
)
flag
=
np
.
where
((
u10n
<
0
)
&
(
flag
==
"n"
),
"u"
,
...
...
@@ -490,7 +489,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
rh
=
np
.
ones
(
sst
.
shape
)
*
80
elif
(
hum
[
0
]
==
'rh'
):
rh
=
hum
[
1
]
rh
=
np
.
where
(
rh
>
100
,
np
.
nan
,
rh
)
#
rh = np.where(rh > 100, np.nan, rh)
elif
(
hum
[
0
]
==
'Td'
):
Td
=
hum
[
1
]
# dew point temperature (K)
Td
=
np
.
where
(
Td
<
200
,
np
.
copy
(
Td
)
+
CtoK
,
np
.
copy
(
Td
))
...
...
@@ -498,7 +497,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
esd
=
611.21
*
np
.
exp
(
17.502
*
((
Td
-
CtoK
)
/
(
Td
-
32.19
)))
es
=
611.21
*
np
.
exp
(
17.502
*
((
T
-
CtoK
)
/
(
T
-
32.19
)))
rh
=
100
*
esd
/
es
rh
=
np
.
where
(
rh
>
100
,
np
.
nan
,
rh
)
#
rh = np.where(rh > 100, np.nan, rh)
res
=
np
.
zeros
((
39
,
len
(
spd
)))
res
[
0
][:]
=
tau
...
...
This diff is collapsed.
Click to expand it.
hum_subs.py
View file @
9bda0f47
...
...
@@ -380,7 +380,7 @@ def get_hum(hum, T, sst, P, qmeth):
if
(
np
.
all
(
RH
<
1
)):
sys
.
exit
(
"input relative humidity units should be \%"
)
qair
,
qsea
=
np
.
nan
,
np
.
nan
RH
=
np
.
where
(
RH
>
100
,
np
.
nan
,
RH
)
# ensure RH <=100
#
RH = np.where(RH > 100, np.nan, RH) # ensure RH <=100
qsea
=
qsat_sea
(
sst
,
P
,
qmeth
)
/
1000
# surface water q (kg/kg)
qair
=
qsat_air
(
T
,
P
,
RH
,
qmeth
)
/
1000
# q of air (kg/kg)
elif
(
hum
[
0
]
==
'q'
):
...
...
@@ -393,7 +393,7 @@ def get_hum(hum, T, sst, P, qmeth):
esd
=
611.21
*
np
.
exp
(
17.502
*
((
Td
-
273.16
)
/
(
Td
-
32.19
)))
es
=
611.21
*
np
.
exp
(
17.502
*
((
T
-
273.16
)
/
(
T
-
32.19
)))
RH
=
100
*
esd
/
es
RH
=
np
.
where
(
RH
>
100
,
np
.
nan
,
RH
)
# ensure RH <=100
#
RH = np.where(RH > 100, np.nan, RH)
# ensure RH <=100
qair
=
qsat_air
(
T
,
P
,
RH
,
qmeth
)
/
1000
# q of air (kg/kg)
qsea
=
qsat_sea
(
sst
,
P
,
qmeth
)
/
1000
# surface water q (kg/kg)
return
qair
,
qsea
...
...
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