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
2b54f052
Commit
2b54f052
authored
3 years ago
by
Richard Cornes
Browse files
Options
Download
Email Patches
Plain Diff
Removed CtoK conversion in subfunctions
parent
d952a829
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
11 deletions
+22
-11
Code/AirSeaFluxCode.py
Code/AirSeaFluxCode.py
+13
-9
Code/AirSeaFluxCode_test.py
Code/AirSeaFluxCode_test.py
+7
-1
Code/hum_subs.py
Code/hum_subs.py
+2
-1
No files found.
Code/AirSeaFluxCode.py
View file @
2b54f052
...
...
@@ -39,14 +39,16 @@ class S88:
def
_get_potentialT
(
self
):
self
.
cp
=
1004.67
*
(
1
+
0.00084
*
self
.
qsea
)
self
.
th
=
np
.
where
(
self
.
T
<
200
,
(
np
.
copy
(
self
.
T
)
+
CtoK
)
*
np
.
power
(
1000
/
self
.
P
,
287.1
/
self
.
cp
),
np
.
copy
(
self
.
T
)
*
np
.
power
(
1000
/
self
.
P
,
287.1
/
self
.
cp
))
# potential T
# self.th = np.where(self.T < 200, (np.copy(self.T)+CtoK) *
# np.power(1000/self.P, 287.1/self.cp),
# np.copy(self.T)*np.power(1000/self.P, 287.1/self.cp)) # potential T
self
.
th
=
np
.
copy
(
self
.
T
)
*
np
.
power
(
1000
/
self
.
P
,
287.1
/
self
.
cp
)
def
_get_lapse
(
self
):
self
.
tlapse
=
gamma
(
"dry"
,
self
.
SST
,
self
.
T
,
self
.
qair
/
1000
,
self
.
cp
)
self
.
Ta
=
np
.
where
(
self
.
T
<
200
,
np
.
copy
(
self
.
T
)
+
CtoK
+
self
.
tlapse
*
self
.
h_in
[
1
],
np
.
copy
(
self
.
T
)
+
self
.
tlapse
*
self
.
h_in
[
1
])
# convert to Kelvin if needed
# self.Ta = np.where(self.T < 200, np.copy(self.T)+CtoK+self.tlapse*self.h_in[1],
# np.copy(self.T)+self.tlapse*self.h_in[1]) # convert to Kelvin if needed
self
.
Ta
=
np
.
copy
(
self
.
T
)
+
self
.
tlapse
*
self
.
h_in
[
1
]
self
.
dt
=
self
.
Ta
-
self
.
SST
def
_fix_coolskin_warmlayer
(
self
,
wl
,
cskin
,
skin
,
Rl
,
Rs
):
...
...
@@ -151,7 +153,8 @@ class S88:
self
.
_wind_firstguess
()
# Rb eq. 11 Grachev & Fairall 1997
Rb
=
self
.
grav
*
10
*
(
self
.
dtv
)
/
(
np
.
where
(
self
.
T
<
200
,
np
.
copy
(
self
.
T
)
+
CtoK
,
np
.
copy
(
self
.
T
))
*
np
.
power
(
self
.
wind
,
2
))
#Rb = self.grav*10*(self.dtv)/(np.where(self.T < 200, np.copy(self.T)+CtoK, np.copy(self.T)) * np.power(self.wind, 2))
Rb
=
self
.
grav
*
10
*
(
self
.
dtv
)
/
(
np
.
copy
(
self
.
T
)
*
np
.
power
(
self
.
wind
,
2
))
self
.
monob
=
1
/
Rb
# eq. 12 Grachev & Fairall 1997
# ------------
...
...
@@ -334,8 +337,8 @@ class S88:
elif
(
self
.
hum
[
0
]
==
'Td'
):
Td
=
self
.
hum
[
1
]
# dew point temperature (K)
Td
=
np
.
where
(
Td
<
200
,
np
.
copy
(
Td
)
+
CtoK
,
np
.
copy
(
Td
))
T
=
np
.
where
(
self
.
T
<
200
,
np
.
copy
(
self
.
T
)
+
CtoK
,
np
.
copy
(
self
.
T
))
#
T = np.copy(self.T)
#
T = np.where(self.T < 200, np.copy(self.T)+CtoK, np.copy(self.T))
T
=
np
.
copy
(
self
.
T
)
esd
=
611.21
*
np
.
exp
(
17.502
*
((
Td
-
CtoK
)
/
(
Td
-
32.19
)))
es
=
611.21
*
np
.
exp
(
17.502
*
((
T
-
CtoK
)
/
(
T
-
32.19
)))
self
.
rh
=
100
*
esd
/
es
...
...
@@ -476,7 +479,8 @@ class S88:
self
.
arr_shp
=
spd
.
shape
self
.
nlen
=
len
(
spd
)
self
.
spd
=
spd
self
.
T
=
T
#self.T = T
self
.
T
=
np
.
where
(
T
<
200
,
np
.
copy
(
T
)
+
CtoK
,
np
.
copy
(
T
))
self
.
hum
=
[
'no'
,
np
.
full
(
SST
.
shape
,
80
)]
if
hum
is
None
else
hum
self
.
SST
=
np
.
where
(
SST
<
200
,
np
.
copy
(
SST
)
+
CtoK
,
np
.
copy
(
SST
))
self
.
lat
=
np
.
full
(
self
.
arr_shp
,
45
)
if
lat
is
None
else
lat
...
...
This diff is collapsed.
Click to expand it.
Code/AirSeaFluxCode_test.py
View file @
2b54f052
...
...
@@ -622,4 +622,10 @@ print(res)
for
i
in
res1
.
columns
:
print
(
res1
[
i
].
equals
(
res
[
i
]))
try
:
a
=
res1
[
i
].
round
(
4
)
b
=
res
[
i
].
round
(
4
)
print
(
a
.
equals
(
b
))
except
:
print
(
res1
[
i
].
equals
(
res
[
i
]))
This diff is collapsed.
Click to expand it.
Code/hum_subs.py
View file @
2b54f052
...
...
@@ -54,7 +54,8 @@ def VaporPressure(temp, P, phase, meth):
if
(
np
.
nanmin
(
temp
)
>
200
):
# if Ta in Kelvin convert to Celsius
temp
=
temp
-
273.16
T
=
np
.
copy
(
temp
)
+
273.16
# Most formulas use T in [K]
# Formulas using [C] use the variable temp
# Formulas using [C] use the variable temp
# Calculate saturation pressure over liquid water
if
(
phase
==
'liquid'
):
if
(
meth
==
'HylandWexler'
or
meth
==
''
):
...
...
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