def compare_variable_attributes(fdatasets, r, name_list, sDir): vars_df = pd.DataFrame() for ii in range(len(fdatasets)): print('\n', fdatasets[ii].split('/')[-1]) deployment = fdatasets[ii].split('/')[-1].split('_')[0].split('deployment')[-1] deployment = int(deployment) ds = xr.open_dataset(fdatasets[ii], mask_and_scale=False) time = ds['time'].values dr_dp = '-'.join((str(deployment))) #,ds.collection_method, ds.stream ''' variable list ''' var_list = cf.notin_list(ds.data_vars.keys(), ['time', '_qc_']) z_id, z_data, z_unit, z_name, z_fill = cf.add_pressure_to_dictionary_of_sci_vars(ds) df = pd.DataFrame({'var_id':[z_id], 'units':[z_unit[0]], 'long_name':[z_name[0]], 'fill_values':[z_fill[0]]},index=[dr_dp]) vars_df = vars_df.append(df) for vname in name_list: vname_id, vname_unit, vname_name, vname_fv = get_variable_data(ds, var_list, vname) df = pd.DataFrame({'var_id':[vname_id], 'units':[vname_unit], 'long_name':[vname_name], 'fill_values':[str(vname_fv)]},index=[dr_dp]) vars_df = vars_df.append(df) vars_df = vars_df.drop_duplicates() vars_df.to_csv('{}/{}_velocity_variables.csv'.format(sDir, r), index=True) return vars_df
def plot_velocity_variables(r, fdatasets, num_plots, save_dir): fig, ax = plt.subplots(nrows=num_plots, ncols=1, sharey=True) fig.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig_file = 'calculated_currents_plot' fig0, ax0 = plt.subplots(nrows=num_plots, ncols=1, sharey=True) fig0.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig0_file = 'uvw_plots' fig1, ax1 = plt.subplots(nrows=num_plots, ncols=1, sharey=True) fig1.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig1_file = 'pressure_plots' fig2, ax2 = plt.subplots(nrows=num_plots, ncols=1, sharey=True) fig2.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig2_file = 'roll_plots' fig3, ax3 = plt.subplots(nrows=num_plots, ncols=1, sharey=True) fig3.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig3_file = 'pitch_plots' for ii in range(len(fdatasets)): if num_plots > len(fdatasets): for jj in range(len(fdatasets), num_plots, 1): ax[jj].axis('off') ax0[jj].axis('off') # ax0[jj].axis('tight') ax1[jj].axis('off') ax2[jj].axis('off') ax3[jj].axis('off') print('\n', fdatasets[ii].split('/')[-1]) deployment = fdatasets[ii].split('/')[-1].split('_')[0].split( 'deployment')[-1] deployment = int(deployment) ds = xr.open_dataset(fdatasets[ii], mask_and_scale=False) time = ds['time'].values ''' variable list ''' var_list = cf.notin_list(ds.data_vars.keys(), ['time', '_qc_']) z_name, z_data, z_unit, z_name, z_fill = cf.add_pressure_to_dictionary_of_sci_vars( ds) z_data, err_count_z = reject_err_data_1_dims(z_data, z_fill[0], r, z_name[0], n=5) if 'VELPT' in r: w_id, w_data, w_unit, w_name, w_fill = get_variable_data( ds, var_list, 'upward_velocity') w_data, err_count_w = reject_err_data_1_dims(w_data, w_fill, r, w_id, n=5) u_id, u_data, u_unit, u_name, u_fill = get_variable_data( ds, var_list, 'eastward_velocity') u_data, err_count_u = reject_err_data_1_dims(u_data, u_fill, r, u_id, n=5) v_id, v_data, v_unit, v_name, v_fill = get_variable_data( ds, var_list, 'northward_velocity') v_data, err_count_v = reject_err_data_1_dims(v_data, v_fill, r, v_id, n=5) roll_id, roll_data, roll_unit, roll_name, roll_fill = get_variable_data( ds, var_list, 'roll') roll_data, err_count_roll = reject_err_data_1_dims(roll_data, roll_fill, r, roll_id, n=5) pitch_id, pitch_data, pitch_unit, pitch_name, pitch_fill = get_variable_data( ds, var_list, 'pitch') pitch_data, err_count_pitch = reject_err_data_1_dims(pitch_data, pitch_fill, r, pitch_id, n=5) ''' According to VELPT manufacturer, data are suspect when the instrument is tilted more than 20 degrees redmine ticket # 12960 ''' tilt_ind = np.logical_or( abs(pitch_data) > 200, abs(roll_data) > 200) percent_good = ( (len(time) - len(time[tilt_ind])) / len(time)) * 100 elif 'VEL3D' in r: w_id, w_data, w_unit, w_name, w_fill = get_variable_data( ds, var_list, 'upward_turbulent_velocity') w_data, err_count_w = reject_err_data_1_dims(w_data, w_fill, r, w_id, n=5) u_id, u_data, u_unit, u_name, u_fill = get_variable_data( ds, var_list, 'eastward_turbulent_velocity') u_data, err_count_u = reject_err_data_1_dims(u_data, u_fill, r, u_id, n=5) v_id, v_data, v_unit, v_name, v_fill = get_variable_data( ds, var_list, 'northward_turbulent_velocity') v_data, err_count_v = reject_err_data_1_dims(v_data, v_fill, r, v_id, n=5) ''' Plot pressure ''' ax1[ii].plot(time, z_data, 'b.', linestyle='None', marker='.', markersize=0.5) #linestyle='--', linewidth=.6 if 'VELPT' in r: ax1[ii].plot(time[tilt_ind], z_data[tilt_ind], 'r.', linestyle='None', marker='.', markersize=0.5, label=str(round(100 - percent_good, 2)) + '%') prepare_axis(r, time, deployment, ax1[ii], ii, len(fdatasets), z_name[0], z_unit[0], err_count=err_count_z) fig1_file = fig1_file + str(deployment) if 'VELPT' in r: ''' plot roll ''' ax2[ii].plot(time, roll_data, 'b.', linestyle='None', marker='.', markersize=0.5) ax2[ii].plot(time[tilt_ind], roll_data[tilt_ind], 'r.', linestyle='None', marker='.', markersize=0.5, label=str(round(100 - percent_good, 2)) + '%') prepare_axis(r, time, deployment, ax2[ii], ii, len(fdatasets), roll_name, roll_unit, err_count=err_count_roll) fig2_file = fig2_file + str(deployment) ''' plot pitch ''' ax3[ii].plot(time, pitch_data, 'b.', linestyle='None', marker='.', markersize=0.5) ax3[ii].plot(time[tilt_ind], pitch_data[tilt_ind], 'r.', linestyle='None', marker='.', markersize=0.5, label=str(round(100 - percent_good, 2)) + '%') prepare_axis(r, time, deployment, ax3[ii], ii, len(fdatasets), pitch_name, pitch_unit, err_count=err_count_pitch) fig3_file = fig3_file + str(deployment) ''' 1D Quiver plot ''' ax[ii].quiver(time, 0, u_data, v_data, color='b', units='y', scale_units='y', scale=1, headlength=1, headaxislength=1, width=0.004, alpha=0.5) if 'VELPT' in r: ax[ii].quiver(time[tilt_ind], 0, u_data[tilt_ind], v_data[tilt_ind], color='r', units='y', scale_units='y', scale=1, headlength=1, headaxislength=1, width=0.004, alpha=0.5, label=str(round(100 - percent_good, 2)) + '%') uv_magnitude = np.sqrt(u_data**2 + v_data**2) uv_maxmag = np.nanmax(uv_magnitude) ax[ii].set_ylim(-uv_maxmag, uv_maxmag) prepare_axis(r, time, deployment, ax[ii], ii, len(fdatasets), 'Current Velocity', u_unit, err_count=None) fig_file = fig_file + str(deployment) ''' Plot u and v components ''' ax0[ii].plot(time, v_data, 'b.', linestyle='None', marker='.', markersize=0.5, label='V') if 'VELPT' in r: ax0[ii].plot(time[tilt_ind], v_data[tilt_ind], 'r', linestyle='None', marker='.', markersize=0.5, label=str(round(100 - percent_good, 2)) + '%') ax0[ii].plot(time, u_data, 'g.', linestyle='None', marker='.', markersize=0.5, label='U') if 'VELPT' in r: ax0[ii].plot(time[tilt_ind], u_data[tilt_ind], 'y', linestyle='None', marker='.', markersize=0.5, label=str(round(100 - percent_good, 2)) + '%') ax0[ii].plot(time, w_data, 'm.', linestyle='None', marker='.', markersize=0.5, label='W') if 'VELPT' in r: ax0[ii].plot(time[tilt_ind], w_data[tilt_ind], 'c', linestyle='None', marker='.', markersize=0.5, label=str(round(100 - percent_good, 2)) + '%') prepare_axis(r, time, deployment, ax0[ii], ii, len(fdatasets), 'Velocity Components', u_unit, err_count=None) fig0_file = fig0_file + str(deployment) save_file = os.path.join(save_dir, fig1_file) fig1.savefig(str(save_file), dpi=150, bbox_inches='tight') save_file = os.path.join(save_dir, fig_file) fig.savefig(str(save_file), dpi=150, bbox_inches='tight') save_file = os.path.join(save_dir, fig0_file) fig0.savefig(str(save_file), dpi=150, bbox_inches='tight') save_file = os.path.join(save_dir, fig2_file) fig2.savefig(str(save_file), dpi=150, bbox_inches='tight') save_file = os.path.join(save_dir, fig3_file) fig3.savefig(str(save_file), dpi=150, bbox_inches='tight') plt.close('all')
def plot_velocity_variables(r, fdatasets, num_plots, save_dir): fig0_0x, ax0_0x = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig0_0x.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig0_0x_file = 'v_plots_xsection' fig0_0p, ax0_0p = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig0_0p.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig0_0p_file = 'v_plots_profile' fig0_1x, ax0_1x = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig0_1x.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig0_1x_file = 'u_plots_xsection' fig0_1p, ax0_1p = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig0_1p.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig0_1p_file = 'u_plots_profile' fig0_2x, ax0_2x = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig0_2x.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig0_2x_file = 'w_plots_xsection' fig0_2p, ax0_2p = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig0_2p.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig0_2p_file = 'w_plots_profile' # fig1, ax1 = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) # fig1.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) # fig1_file = 'Calculated_current_plots' fig2x, ax2x = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig2x.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig2x_file = 'roll_plots_xsection' fig2p, ax2p = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig2p.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig2p_file = 'roll_plots_profile' fig3x, ax3x = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig3x.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig3x_file = 'pitch_plots_xsection' fig3p, ax3p = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig3p.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig3p_file = 'pitch_plots_profile' fig4x, ax4x = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig4x.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig4x_file = 'calculated_current_magnitude_plots_xsection' fig4p, ax4p = pyplot.subplots(nrows=num_plots, ncols=1, sharey=True) fig4p.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0) fig4p_file = 'calculated_current_magnitude_plots_profile' if num_plots > len(fdatasets): for jj in range(len(fdatasets), num_plots, 1): ax0_0x[jj].axis('off') ax0_1x[jj].axis('off') ax0_2x[jj].axis('off') ax0_0p[jj].axis('off') ax0_1p[jj].axis('off') ax0_2p[jj].axis('off') # ax1[jj].axis('off') ax2p[jj].axis('off') ax2x[jj].axis('off') ax3x[jj].axis('off') ax4x[jj].axis('off') ax3p[jj].axis('off') ax4p[jj].axis('off') if len(fdatasets) == 1: ax0_0x = [ax0_0x] ax0_1x = [ax0_1x] ax0_2x = [ax0_2x] ax0_0p = [ax0_0p] ax0_1p = [ax0_1p] ax0_2p = [ax0_2p] # ax1 = [ax1] ax2p = [ax2p] ax2x = [ax2x] ax3x = [ax3x] ax4x = [ax4x] ax3p = [ax3p] ax4p = [ax4p] for ii in range(len(fdatasets)): print('\n', fdatasets[ii].split('/')[-1]) deployment = fdatasets[ii].split('/')[-1].split('_')[0].split('deployment')[-1] deployment = int(deployment) ds = xr.open_dataset(fdatasets[ii], mask_and_scale=False) time = ds['time'].values collection_method = ds.collection_method ''' variable list ''' var_list = cf.notin_list(ds.data_vars.keys(), ['time', '_qc_']) z_data, z_unit, z_name, z_fill = cf.add_pressure_to_dictionary_of_sci_vars(ds) z_data, err_count_z = reject_err_data_1_dims(z_data, z_fill[0], r, z_name[0], n=5) w_id, w_data, w_unit, w_name, w_fill = get_variable_data(ds, var_list, 'upward_velocity') w_data, err_count_w = reject_err_data_1_dims(w_data, w_fill, r, w_id, n=5) u_id, u_data, u_unit, u_name, u_fill = get_variable_data(ds, var_list, 'eastward_velocity') u_data, err_count_u = reject_err_data_1_dims(u_data, u_fill, r, u_id, n=5) v_id, v_data, v_unit, v_name, v_fill = get_variable_data(ds, var_list, 'northward_velocity') v_data, err_count_v = reject_err_data_1_dims(v_data, v_fill, r, v_id, n=5) roll_id, roll_data, roll_unit, roll_name, roll_fill = get_variable_data(ds, var_list, 'roll') roll_data, err_count_roll = reject_err_data_1_dims(roll_data, roll_fill, r, roll_id, n=5) pitch_id, pitch_data, pitch_unit, pitch_name, pitch_fill = get_variable_data(ds, var_list, 'pitch') pitch_data, err_count_pitch = reject_err_data_1_dims(pitch_data, pitch_fill, r, pitch_id, n=5) ''' 2D Quiver plot ''' # ax1[ii].quiver(time, z_data, u_data, v_data, color='b', units='y', scale_units='y', scale=1, headlength=1, # headaxislength=1, width=0.004, alpha=0.5) # M = np.sqrt(u_data ** 2 + v_data ** 2) # Q = ax1[ii].quiver(time[::100], z_data[::100], u_data[::100], v_data[::100], M[::100], # units='y', pivot='tip', width=0.022, scale=1 / 0.15) # css = ax1[ii].quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E', coordinates='figure') # # # prepare_axis(css, fig1, ax1[ii],time, [z_name[0], z_unit[0]], ['Current Velocity', u_unit], r, deployment, ii, len(fdatasets), # err_count=None) # # fig1_file = fig1_file + str(deployment) # ''' plot roll ''' # css = ax2p[ii].scatter(roll_data, z_data, c=time, s=2, edgecolor='None', cmap='rainbow') # prepare_axis_profile(css, fig2p, ax2p[ii], time, [z_name[0], z_unit[0]], [roll_name, roll_unit], r, deployment, ii, # len(fdatasets), err_count=err_count_roll) # fig2p_file = fig2p_file + '_deployment' + str(deployment)+ '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # # css = ax2x[ii].scatter(time, z_data, c=roll_data, cmap='RdGy', s=2, edgecolor='None') # prepare_axis_xsection(css, fig2x, ax2x[ii], time, [z_name[0], z_unit[0]], [roll_name, roll_unit], r, deployment, ii, # len(fdatasets), err_count=err_count_roll) # fig2x_file = fig2x_file + '_deployment' + str(deployment) + '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # ''' plot pitch ''' # css = ax3p[ii].scatter(pitch_data, z_data, c=time, s=2, edgecolor='None', cmap='rainbow') # prepare_axis_profile(css, fig3p, ax3p[ii], time, [z_name[0], z_unit[0]], [pitch_name, pitch_unit], r, deployment, ii, # len(fdatasets), err_count=err_count_pitch) # fig3p_file = fig3p_file + '_deployment' + str(deployment) + '_' + fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # css = ax3x[ii].scatter(time, z_data, c=pitch_data, cmap='RdGy', s=2, edgecolor='None') # prepare_axis_xsection(css, fig3x, ax3x[ii], time, [z_name[0], z_unit[0]], [pitch_name, pitch_unit], r, deployment, ii, # len(fdatasets), err_count=err_count_pitch) # fig3x_file = fig3x_file + '_deployment' + str(deployment) + '_' + fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # ''' # plot current magnitude # ''' # uv_magnitude = np.sqrt(u_data ** 2 + v_data ** 2) # # css = ax4p[ii].scatter(uv_magnitude, z_data, c=time, s=2, edgecolor='None', cmap='rainbow') # prepare_axis_profile(css, fig4p, ax4p[ii], time, [z_name[0], z_unit[0]], ['[U,V] Current Velocity', u_unit], # r, deployment, ii, len(fdatasets), err_count=err_count_pitch) # # fig4p_file = fig4p_file + '_deployment' + str(deployment) + '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # css = ax4x[ii].scatter(time, z_data, c=uv_magnitude, cmap='PuBu', s=2, edgecolor='None') # prepare_axis_xsection(css, fig4x, ax4x[ii], time, [z_name[0], z_unit[0]], ['[U,V] Current Velocity', u_unit], # r, deployment, ii, len(fdatasets), err_count=None) # fig4x_file = fig4x_file + '_deployment' + str(deployment) + '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # ''' # Plot v component # ''' # css = ax0_0p[ii].scatter(v_data, z_data, c=time, s=2, edgecolor='None', cmap='rainbow') # prepare_axis_profile(css, fig0_0p, ax0_0p[ii], time, [z_name[0], z_unit[0]], ['[V] Velocity Components', u_unit], # r, deployment, ii, len(fdatasets), err_count=err_count_pitch) # # fig0_0p_file = fig0_0p_file + '_deployment' + str(deployment) + '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # css = ax0_0x[ii].scatter(time, z_data, c=v_data, cmap='RdBu', s=2, edgecolor='None') # prepare_axis_xsection(css, fig0_0x, ax0_0x[ii], time, [z_name[0], z_unit[0]], ['[V] Velocity Components', v_unit], # r, deployment, ii, len(fdatasets), err_count=err_count_v) # fig0_0x_file = fig0_0x_file + '_deployment' + str(deployment) + '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # # ''' # Plot u component # ''' # css = ax0_1p[ii].scatter(u_data, z_data, c=time, s=2, edgecolor='None', cmap='rainbow') # prepare_axis_profile(css, fig0_1p, ax0_1p[ii], time, [z_name[0], z_unit[0]], # ['[U] Velocity Components', u_unit], # r, deployment, ii, len(fdatasets), err_count=err_count_pitch) # # fig0_1p_file = fig0_1p_file + '_deployment' + str(deployment) + '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # css = ax0_1x[ii].scatter(time, z_data, c=u_data, cmap='RdBu', s=2, edgecolor='None') # prepare_axis_xsection(css, fig0_1x, ax0_1x[ii], time, [z_name[0], z_unit[0]], ['[U] Velocity Components', u_unit], # r, deployment, ii, len(fdatasets), err_count=err_count_u) # # fig0_1x_file = fig0_1x_file + '_deployment' + str(deployment) + '_' + \ # fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # ''' # Plot w component # ''' css = ax0_2p[ii].scatter(w_data, z_data, c=time, s=2, edgecolor='None', cmap='rainbow') prepare_axis_profile(css, fig0_2p, ax0_2p[ii], time, [z_name[0], z_unit[0]], ['[W] Velocity Components', u_unit], r, deployment, ii, len(fdatasets), err_count=err_count_pitch) fig0_2p_file = fig0_2p_file + '_deployment' + str(deployment) + '_' + \ fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] css = ax0_2x[ii].scatter(time, z_data, c=w_data, cmap='RdBu', s=2, edgecolor='None') prepare_axis_xsection(css, fig0_2x, ax0_2x[ii], time, [z_name[0], z_unit[0]], ['[W] Velocity Components', w_unit], r, deployment, ii, len(fdatasets), err_count=err_count_w) fig0_2x_file = fig0_2x_file + '_deployment' + str(deployment) + '_' + \ fdatasets[ii].split('/')[-1].split('_')[-1].split('.')[0] # # # save_file = os.path.join(save_dir, fig1_file) # fig1.savefig(str(save_file), dpi=150, bbox_inches='tight') # save_file = os.path.join(save_dir, fig2p_file) # fig2p.savefig(str(save_file), dpi=150, bbox_inches='tight') # # save_file = os.path.join(save_dir, fig2x_file) # fig2x.savefig(str(save_file), dpi=150, bbox_inches='tight') # save_file = os.path.join(save_dir, fig3p_file) # fig3p.savefig(str(save_file), dpi=150, bbox_inches='tight') # # save_file = os.path.join(save_dir, fig3x_file) # fig3x.savefig(str(save_file), dpi=150, bbox_inches='tight') # # # save_file = os.path.join(save_dir, fig4p_file) # fig4p.savefig(str(save_file), dpi=150, bbox_inches='tight') # # save_file = os.path.join(save_dir, fig4x_file) # fig4x.savefig(str(save_file), dpi=150, bbox_inches='tight') # # save_file = os.path.join(save_dir, fig0_0p_file) # fig0_0p.savefig(str(save_file), dpi=150, bbox_inches='tight') # # save_file = os.path.join(save_dir, fig0_0x_file) # fig0_0x.savefig(str(save_file), dpi=150, bbox_inches='tight') # # # save_file = os.path.join(save_dir, fig0_1p_file) # fig0_1p.savefig(str(save_file), dpi=150, bbox_inches='tight') # # save_file = os.path.join(save_dir, fig0_1x_file) # fig0_1x.savefig(str(save_file), dpi=150, bbox_inches='tight') # # save_file = os.path.join(save_dir, fig0_2p_file) fig0_2p.savefig(str(save_file), dpi=150, bbox_inches='tight') save_file = os.path.join(save_dir, fig0_2x_file) fig0_2x.savefig(str(save_file), dpi=150, bbox_inches='tight') pyplot.close(fig0_0p) pyplot.close(fig0_0x) pyplot.close(fig0_1p) pyplot.close(fig0_1x) pyplot.close(fig0_2p) pyplot.close(fig0_2x) pyplot.close(fig2p) pyplot.close(fig2x) pyplot.close(fig3p) pyplot.close(fig3x) pyplot.close(fig4p) pyplot.close(fig4x)