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
f5182368
Commit
f5182368
authored
3 years ago
by
sbiri
Browse files
Options
Download
Email Patches
Plain Diff
Do not calculate lhf if a measure of humidity is not input
parent
1193dc44
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
AirSeaFluxCode.py
AirSeaFluxCode.py
+19
-9
get_init.py
get_init.py
+1
-1
hum_subs.py
hum_subs.py
+2
-3
No files found.
AirSeaFluxCode.py
View file @
f5182368
...
...
@@ -128,9 +128,9 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
39. relative humidity (rh)
40. thickness of the viscous layer (delta)
41. lv latent heat of vaporization (Jkg−1)
4
0
. flag ("n": normal, "o": out of nominal range,
4
2
. flag ("n": normal, "o": out of nominal range,
"u": u10n<0, "q":q10n<0
"m": missing,
"m": missing,
"l": Rib<-0.5 or Rib>0.2 or z/L>1000,
"r" : rh>100%,
"i": convergence fail at n)
...
...
@@ -180,9 +180,7 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
np
.
round
(
np
.
nanmedian
(
qair
),
7
))
if
(
np
.
all
(
np
.
isnan
(
qsea
))
or
np
.
all
(
np
.
isnan
(
qair
))):
print
(
"qsea and qair cannot be nan"
)
if
(
hum
==
None
):
rh
=
np
.
ones
(
sst
.
shape
)
*
80
elif
(
hum
[
0
]
==
'rh'
):
if
((
hum
[
0
]
==
'rh'
)
or
(
hum
[
0
]
==
'no'
)):
rh
=
hum
[
1
]
elif
(
hum
[
0
]
==
'Td'
):
Td
=
hum
[
1
]
# dew point temperature (K)
...
...
@@ -193,8 +191,11 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
rh
=
100
*
esd
/
es
flag
=
np
.
empty
(
spd
.
shape
,
dtype
=
"object"
)
flag
[:]
=
"n"
flag
=
np
.
where
(
np
.
isnan
(
spd
+
T
+
SST
+
hum
[
1
]
+
P
+
Rs
+
Rl
),
"m"
,
flag
)
flag
=
np
.
where
(
rh
>
100
,
"r"
,
flag
)
if
(
hum
[
0
]
==
'no'
):
flag
=
np
.
where
(
np
.
isnan
(
spd
+
T
+
SST
+
P
+
Rs
+
Rl
),
"m"
,
flag
)
else
:
flag
=
np
.
where
(
np
.
isnan
(
spd
+
T
+
SST
+
hum
[
1
]
+
P
+
Rs
+
Rl
),
"m"
,
flag
)
flag
=
np
.
where
(
rh
>
100
,
"r"
,
flag
)
dt
=
Ta
-
sst
dq
=
qair
-
qsea
...
...
@@ -530,6 +531,14 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
if
(((
cskin
==
0
)
and
(
wl
==
0
))
and
(
np
.
all
(
Rl
==
370
)
and
np
.
all
(
Rs
==
150
))):
Rl
,
Rs
,
Rnl
=
Rl
*
np
.
nan
,
Rs
*
np
.
nan
,
Rnl
*
np
.
nan
# Do not calculate lhf if a measure of humidity is not input
if
(
hum
[
0
]
==
'no'
):
latent
=
np
.
ones
(
sst
.
shape
)
*
np
.
nan
qsr
=
np
.
ones
(
sst
.
shape
)
*
np
.
nan
q10n
=
np
.
ones
(
sst
.
shape
)
*
np
.
nan
qref
=
np
.
ones
(
sst
.
shape
)
*
np
.
nan
qair
=
np
.
ones
(
sst
.
shape
)
*
np
.
nan
rh
=
np
.
ones
(
sst
.
shape
)
*
np
.
nan
res
=
np
.
zeros
((
41
,
len
(
spd
)))
res
[
0
][:]
=
tau
...
...
@@ -577,8 +586,9 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
if
(
out
==
0
):
res
[:,
ind
]
=
np
.
nan
# set missing values where data have non acceptable values
res
=
np
.
asarray
([
np
.
where
(
q10n
<
0
,
np
.
nan
,
res
[
i
][:])
for
i
in
range
(
41
)])
if
(
hum
[
0
]
!=
'no'
):
res
=
np
.
asarray
([
np
.
where
(
q10n
<
0
,
np
.
nan
,
res
[
i
][:])
for
i
in
range
(
41
)])
res
=
np
.
asarray
([
np
.
where
(
u10n
<
0
,
np
.
nan
,
res
[
i
][:])
for
i
in
range
(
41
)])
# output with pandas
...
...
This diff is collapsed.
Click to expand it.
get_init.py
View file @
f5182368
...
...
@@ -108,7 +108,7 @@ def get_init(spd, T, SST, lat, hum, P, Rl, Rs, cskin, skin, wl, gust, L, tol,
lat
=
np
.
ones
(
spd
.
shape
)
*
np
.
copy
(
lat
)
if
(
hum
==
None
):
RH
=
np
.
ones
(
SST
.
shape
)
*
80
hum
=
[
'
rh
'
,
RH
]
hum
=
[
'
no
'
,
RH
]
else
:
hum
=
hum
if
((
np
.
all
(
P
==
None
))
or
np
.
all
(
np
.
isnan
(
P
))):
...
...
This diff is collapsed.
Click to expand it.
hum_subs.py
View file @
f5182368
...
...
@@ -372,15 +372,14 @@ def get_hum(hum, T, sst, P, qmeth):
specific humidity over sea surface
"""
if
(
hum
[
0
]
not
in
[
'rh'
,
'q'
,
'Td'
]):
if
(
hum
[
0
]
not
in
[
'rh'
,
'q'
,
'Td'
,
'no'
]):
sys
.
exit
(
"unknown humidity input"
)
qair
,
qsea
=
np
.
nan
,
np
.
nan
elif
(
hum
[
0
]
==
'rh'
):
elif
(
(
hum
[
0
]
==
'rh'
)
or
(
hum
[
0
]
==
'no'
))
:
RH
=
hum
[
1
]
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
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'
):
...
...
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