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
7934c1c1
Commit
7934c1c1
authored
4 years ago
by
sbiri
Browse files
Options
Download
Email Patches
Plain Diff
Update AirSeaFluxCode.py, get_init.py, hum_subs.py files
parent
94f700e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
AirSeaFluxCode.py
AirSeaFluxCode.py
+8
-7
get_init.py
get_init.py
+9
-2
hum_subs.py
hum_subs.py
+1
-5
No files found.
AirSeaFluxCode.py
View file @
7934c1c1
...
...
@@ -136,14 +136,15 @@ def AirSeaFluxCode(spd, T, SST, lat=None, hum=None, P=None, hin=18, hout=10,
format
=
'%(asctime)s %(message)s'
,
level
=
logging
.
INFO
)
logging
.
captureWarnings
(
True
)
# check input values and set defaults where appropriate
lat
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
tol
,
L
=
get_init
(
spd
,
T
,
SST
,
lat
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
L
,
tol
,
meth
,
qmeth
)
lat
,
hum
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
tol
,
L
=
get_init
(
spd
,
T
,
SST
,
lat
,
hum
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
L
,
tol
,
meth
,
qmeth
)
flag
=
np
.
ones
(
spd
.
shape
,
dtype
=
"object"
)
*
"n"
flag
=
np
.
where
(
np
.
isnan
(
spd
+
T
+
SST
+
lat
+
hum
[
1
]
+
P
+
Rs
)
&
(
flag
==
"n"
),
"m"
,
np
.
where
(
np
.
isnan
(
spd
+
T
+
SST
+
lat
+
hum
[
1
]
+
P
+
Rs
)
&
(
flag
!=
"n"
),
flag
+
[
","
]
+
[
"m"
],
flag
))
flag
=
np
.
where
(
np
.
isnan
(
spd
+
T
+
SST
+
lat
+
hum
[
1
]
+
P
+
Rs
),
"m"
,
flag
)
ref_ht
=
10
# reference height
h_in
=
get_heights
(
hin
,
len
(
spd
))
# heights of input measurements/fields
h_out
=
get_heights
(
hout
,
1
)
# desired height of output variables
...
...
This diff is collapsed.
Click to expand it.
get_init.py
View file @
7934c1c1
import
numpy
as
np
import
sys
def
get_init
(
spd
,
T
,
SST
,
lat
,
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
,
meth
,
qmeth
):
"""
Checks initial input values and sets defaults if needed
...
...
@@ -17,6 +17,8 @@ def get_init(spd, T, SST, lat, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth,
sea surface temperature in K
lat : float
latitude (deg), default 45deg
hum : float
relative humidity, if None is set to 80%
P : float
air pressure (hPa), default 1013hPa
Rl : float
...
...
@@ -100,6 +102,11 @@ def get_init(spd, T, SST, lat, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth,
lat
=
45
*
np
.
ones
(
spd
.
shape
)
elif
((
np
.
all
(
lat
!=
None
))
and
(
np
.
size
(
lat
)
==
1
)):
lat
=
np
.
ones
(
spd
.
shape
)
*
np
.
copy
(
lat
)
if
(
hum
==
None
):
RH
=
np
.
ones
(
SST
.
shape
)
*
80
hum
=
[
'rh'
,
RH
]
else
:
hum
=
hum
if
((
np
.
all
(
P
==
None
))
or
np
.
all
(
np
.
isnan
(
P
))):
P
=
np
.
ones
(
spd
.
shape
)
*
1013
elif
(((
np
.
all
(
P
!=
None
))
or
np
.
all
(
~
np
.
isnan
(
P
)))
and
np
.
size
(
P
)
==
1
):
...
...
@@ -149,4 +156,4 @@ def get_init(spd, T, SST, lat, P, Rl, Rs, cskin, skin, wl, gust, L, tol, meth,
tol
=
[
'flux'
,
1e-3
,
0.1
,
0.1
]
elif
(
tol
[
0
]
not
in
[
'flux'
,
'ref'
,
'all'
]):
sys
.
exit
(
"unknown tolerance input"
)
return
lat
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
tol
,
L
return
lat
,
hum
,
P
,
Rl
,
Rs
,
cskin
,
skin
,
wl
,
gust
,
tol
,
L
This diff is collapsed.
Click to expand it.
hum_subs.py
View file @
7934c1c1
...
...
@@ -372,11 +372,7 @@ def get_hum(hum, T, sst, P, qmeth):
specific humidity over sea surface
"""
if
(
hum
==
None
):
RH
=
np
.
ones
(
sst
.
shape
)
*
80
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
]
not
in
[
'rh'
,
'q'
,
'Td'
]):
if
(
hum
[
0
]
not
in
[
'rh'
,
'q'
,
'Td'
]):
sys
.
exit
(
"unknown humidity input"
)
qair
,
qsea
=
np
.
nan
,
np
.
nan
elif
(
hum
[
0
]
==
'rh'
):
...
...
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