def main(ds):
"""
Creates an overview plot for the Lyman-Alpha total water content probe (TWC).
It calls all plotting functions and sets up axes layout.
"""
#Setup up axes layout
gs=gridspec.GridSpec(2, 1, height_ratios=[1,4])
top_cell=gs[0,0]
bottom_cell=gs[1,0]
#sets up bottom 4 axes; dp timeseries, twc timeseries, twc status and cloud status
gs1=gridspec.GridSpecFromSubplotSpec(4,1, bottom_cell, height_ratios=[1,1,10,10], hspace=0.05)
fig=QaQc_Figure().setup()
ax_dp_ts=fig.add_subplot(gs1[3])
ax_twc_temperatures_ts=fig.add_subplot(gs1[2], sharex=fig.get_axes()[0])
ax_twc_status=fig.add_subplot(gs1[1], sharex=fig.get_axes()[0])
ax_cloud_ts=fig.add_subplot(gs1[0], sharex=fig.get_axes()[0])
#sets up top 2 axes; ge scatter and wvss2r scatter
gs2=gridspec.GridSpecFromSubplotSpec(1,2, top_cell)
ax_scatter_ge=fig.add_subplot(gs2[0], aspect='equal')
ax_scatter_wvss2r=fig.add_subplot(gs2[1], aspect='equal')
set_suptitle(fig, ds, 'QA-Total Water Content Probe')
data=get_data(ds, VARIABLE_NAMES)
for k in data.keys():
if not 'int' in str(data[k].dtype):
data[k][data[k] == -9999.] = np.nan
#Call the plotting methods below:
plot_dp_timeseries(ax_dp_ts, data)
plot_twc_temperatures(ax_twc_temperatures_ts, data)
plot_twc_status(ax_twc_status, data)
plot_cloud(ax_cloud_ts, data)
plot_twc_vs_ge(ax_scatter_ge, data)
plot_twc_vs_wvss2f(ax_scatter_wvss2r, data)
#adds grey bar showing takeoff/landing and only plots the flight
ax=fig.get_axes()[0]
zoom_to_flight_duration(ax, data)
add_time_buffer(ax)
for ax in fig.get_axes()[0:4]:
add_takeoff(ax, data)
add_landing(ax, data)
return fig
#plt.close('all')
#ds = netCDF4.Dataset('./data/twc_extract_20160215_b943.nc', 'r')
#ds=d
#fig = main(ds)
#fig.savefig('/home/axel/test.png')
评论列表
文章目录