Skip to content

Commit c5c8134

Browse files
committed
update per reviewer suggestion - added mean DARDAR DY2 line
1 parent 4cff6ff commit c5c8134

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed
-35.8 KB
Loading

python_scripts/figure09_cldprofiles.py

100644100755
Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#!/usr/bin/env python3.6m
2+
3+
import numpy as np
14
import xarray as xr
25
from matplotlib import pyplot as plt
36
import matplotlib.colors as mcolors
47
from utility import analysis_parameters as ap
5-
import numpy as np
68
import dask
79

810
region='TWP'
@@ -96,7 +98,7 @@ def get_dardar_dy1():
9698
return iwc, cl, z
9799

98100

99-
def get_dardar_dy2():
101+
def get_dardar_dy2_span():
100102
# DARDAR 9 years of Febs
101103
ds = xr.open_dataset(ap.TWP+"DARDAR-CLOUD_v2.1.1_ALL_FEB_DATA.nc")
102104
z = ds.z
@@ -110,6 +112,15 @@ def get_dardar_dy2():
110112
iwc_low.shape, iwc_hgh.shape, cl.shape, z.shape)
111113
return iwc_low, iwc_hgh, cl_min, cl_max, z
112114

115+
def get_dardar_dy2():
116+
ds = xr.open_dataset(ap.TWP+"DARDAR-CLOUD_v2.1.1_ALL_FEB_DATA.nc")
117+
z = ds.z
118+
cl = ds.iwc.where(ds.iwc==0,other=1).groupby(ds.time.dt.year).mean()
119+
cl_mean = cl.mean(axis=0)
120+
iwc = ds.iwc.mean(axis=0)
121+
print("DARDAR_DY2 - Feb mean 2007-2017... shapes of iwc, cl, and z", iwc.shape, cl.shape, z.shape)
122+
return iwc, cl_mean, z
123+
113124
def plot_cldprofiles():
114125
""" plot all the models profiles of iwc + lwc and cld frac (5e-7 kg/m3)"""
115126
fig, [[ax, axt],[axb, axbt]] = plt.subplots(2,2, figsize=(8,9), constrained_layout=True, sharey=True)
@@ -155,7 +166,7 @@ def plot_cldprofiles():
155166
ax.plot(cl[n:-101], (z/1000)[n:-101], color=colors["OBS2"], linestyle="dashed", lw=2)
156167
axt.plot(iwc[n:-101], (z/1000)[n:-101], color=colors["OBS2"], linestyle="dashed", lw=2, label="DARDAR (JAS)")
157168
# plot DARDAR DY2 shading
158-
iwclow, iwchgh, cllow, clhgh, z = get_dardar_dy2()
169+
iwclow, iwchgh, cllow, clhgh, z = get_dardar_dy2_span()
159170
axt.fill_betweenx((z/1000)[n:], iwclow[n:]/1000,iwchgh[n:]/1000,
160171
color=colors["OBS"], alpha=0.2, label="DARDAR span (Feb)")
161172
axbt.fill_betweenx((z/1000)[n:], iwclow[n:]/1000,iwchgh[n:]/1000,
@@ -164,6 +175,11 @@ def plot_cldprofiles():
164175
color=colors["OBS"], alpha=0.2)
165176
axb.fill_betweenx((z/1000)[n:], cllow[n:],clhgh[n:],
166177
color=colors["OBS"], alpha=0.2)
178+
iwc, cl, z = get_dardar_dy2()
179+
axt.plot(iwc[n:]/1000, z[n:]/1000, color=colors["OBS"], alpha=0.4, label="DARDAR Feb mean")
180+
axbt.plot(iwc[n:]/1000, z[n:]/1000, color=colors["OBS"], alpha=0.4, label="DARDAR Feb mean")
181+
ax.plot(cl[n:], z[n:]/1000, color=colors["OBS"], alpha=0.4)
182+
axb.plot(cl[n:], z[n:]/1000, color=colors["OBS"], alpha=0.4)
167183

168184
units = "g/kg" if var2=="cltotal" else "kg m$^{-3}$"
169185

@@ -183,11 +199,13 @@ def plot_cldprofiles():
183199
axbt.legend(loc="center left", bbox_to_anchor=(1.,0.5))
184200

185201
# save figure
186-
print("../plots/figure09_cldprofiles_{}_dy1v2.png".format(var2))
187-
plt.savefig("../plots/figure09_cldprofiles_{}_dy1v2.png".format(var2), dpi=120,
188-
bbox_inches="tight", pad_inches=1)
189-
plt.show()
202+
print("../plots/figure09_cldprofiles_{}_dy1v2.pdf".format(var2))
203+
plt.savefig("../plots/figure09_cldprofiles_{}_dy1v2.pdf".format(var2),
204+
)# rasterized=True)
205+
# plt.show()
190206

191-
207+
208+
if __name__=="__main__":
209+
plot_cldprofiles()
192210

193211

0 commit comments

Comments
 (0)