diff --git a/Matplotlib_common/plot_series.py b/Matplotlib_common/plot_series.py index 597aab7..d88c664 100644 --- a/Matplotlib_common/plot_series.py +++ b/Matplotlib_common/plot_series.py @@ -26,7 +26,7 @@ def plot_series(var_list, plot_iter, nplotx, nploty, axarr, xscaledict, yscaledi series_file.close() linestyles = ['--', '-.', ':'] - dashList = [(3,1),(1,1),(4,1,1,1),(4,2)] + dashList = [(None,None),(3,1),(1,1),(4,1,1,1),(4,2)] plot_my_array(axarr, plot_iter, my_times, my_res, nploty, xlabel=xlabel, ylabel=ylabeldict[var], varlabel=file_labels[label_counter], dashes = dashList[label_counter % len(dashList)], xscale=xscaledict[var], yscale=yscaledict[var], xlim=xlimdict[var], ylim=ylimdict[var], linewidth=linewidth) label_counter+=1 plot_iter = plot_iter + 1 diff --git a/Size_spectra/spectra.py b/Size_spectra/spectra.py index 653d1d3..646b87c 100644 --- a/Size_spectra/spectra.py +++ b/Size_spectra/spectra.py @@ -16,19 +16,27 @@ #to_lvl = int(argv[5]) if plot_dry == True: - size_data = {"rw" : 29, "rd" : 21} + size_data = {"rw" : 250, "rd" : 21} + #size_data = {"rw" : 29, "rd" : 21} else: - size_data = {"rw" : 29} + size_data = {"rw" : 250} + #size_data = {"rw" : 29} #hardcoded bin edges, need to match UWLCM -left_edges = {"rw": np.zeros(30), "rd": np.zeros(22)} -bin_centers = {"rw": np.zeros(29), "rd": np.zeros(21)} -bin_width = {"rw": np.zeros(29), "rd": np.zeros(21)} - -for i in np.arange(30): - left_edges["rw"][i] = 10**(-3 + i * .2) * 1e-6 # [m] - -for i in np.arange(29): +#left_edges = {"rw": np.zeros(30), "rd": np.zeros(22)} +#bin_centers = {"rw": np.zeros(29), "rd": np.zeros(21)} +#bin_width = {"rw": np.zeros(29), "rd": np.zeros(21)} +left_edges = {"rw": np.zeros(251), "rd": np.zeros(22)} +bin_centers = {"rw": np.zeros(250), "rd": np.zeros(21)} +bin_width = {"rw": np.zeros(250), "rd": np.zeros(21)} + +#for i in np.arange(30): +# left_edges["rw"][i] = 10**(-3 + i * .2) * 1e-6 # [m] +for i in np.arange(251): + left_edges["rw"][i] = i * 0.2e-6 # [m] + +for i in np.arange(250): +#for i in np.arange(29): bin_centers["rw"][i] = 0.5 * (left_edges["rw"][i] + left_edges["rw"][i+1]) bin_width["rw"][i] = (left_edges["rw"][i+1] - left_edges["rw"][i]) @@ -59,8 +67,9 @@ labels = argv[7:len(argv):2] print directories, labels -levels = ["ground", "cloud_base"] +#levels = ["ground", "cloud_base"] #levels = ["all", "pi_chamber_measurement_location"] +levels = ["all"]#, "icmw_pi_chamber_nowall"] if plot_dry == True: all_data_names = np.append(data_names["rw"], data_names["rd"]) @@ -123,6 +132,8 @@ total_arr[data][lab] = np.append(total_arr[data][lab], (h5py.File(filename, "r")[data]*rhod)[:,:,:]) if lvl == "pi_chamber_measurement_location": total_arr[data][lab] = np.append(total_arr[data][lab], (h5py.File(filename, "r")[data]*rhod)[32:34,5:6,4:5]) # roughly + assuming dx=0.03125 m + if lvl == "icmw_pi_chamber_nowall": + total_arr[data][lab] = np.append(total_arr[data][lab], (h5py.File(filename, "r")[data]*rhod)[4:61,4:61,4:29]) # hists[lab] = np.hist(total_arr, bins=100) # _ = plt.hist(total_arr, bins='auto') @@ -156,7 +167,9 @@ r_min = min(r_min, left_edges[rwrd][first_nonzero_idx]) r_max = max(r_max, left_edges[rwrd][last_nonzero_idx+1]) print 'r_min = ', r_min, ' r_max = ', r_max - plt.step(bin_centers[rwrd] * 1e6 * 2, avg_conc_arr[rwrd][lab] / bin_width[rwrd] / 1e12 / 2, where='mid', label=rwrd + '_' + lab, linewidth=6) # *1e6 to have microns on x, / 1e12 to adjust for width in microns and to have concentration per cm^3; *2 and /2 to get diameters + avg_conc_arr[rwrd][lab] = avg_conc_arr[rwrd][lab] / bin_width[rwrd] / 1e12 / 2 # / 1e12 to adjust for width in microns and to have concentration per cm^3; /2 to get diameters + plt.step(bin_centers[rwrd] * 1e6 * 2, avg_conc_arr[rwrd][lab], where='mid', label='N=' + lab, linewidth=6) # *1e6 to have microns on x; *2 to get diameters + np.savetxt("LES_N"+lab+"_dsd", avg_conc_arr[rwrd][lab]) # data = total_arr["rain_rw_mom3"].values() diff --git a/drawbicyc/include/drawbicyc/cases/Dycoms_RF02/plots.hpp b/drawbicyc/include/drawbicyc/cases/Dycoms_RF02/plots.hpp index 7ac31af..c64cc36 100644 --- a/drawbicyc/include/drawbicyc/cases/Dycoms_RF02/plots.hpp +++ b/drawbicyc/include/drawbicyc/cases/Dycoms_RF02/plots.hpp @@ -33,7 +33,8 @@ std::vector profs_dycoms({ //,"rad_flx" //, "non_gccn_rw_cl" , "gccn_rw_cl_down" -, "non_gccn_rw_cl_down" +, "gccn_rw_cl_up" +//, "non_gccn_rw_cl_down" //, "nc_up" //,"sat_RH_up" //, "act_conc_up" diff --git a/papers/GCCN_LES/cl_nr_series.py b/papers/GCCN_LES/cl_nr_series.py index 054c87d..92b4205 100644 --- a/papers/GCCN_LES/cl_nr_series.py +++ b/papers/GCCN_LES/cl_nr_series.py @@ -63,7 +63,7 @@ #axes = plt.gca() #axes.tick_params(direction='in') -labeldict=["{\it ScNc45}", "{\it CuNc75}", "{\it CuNc70NoMix}"] +labeldict=["{\it Sc45}", "{\it Cu75}", "{\it Cu70NoSGS}"] y_arr = np.arange(nploty) for y in y_arr: #tics inside diff --git a/papers/GCCN_LES/gccn_rw_profs.py b/papers/GCCN_LES/gccn_rw_profs.py index da4eb2c..0ca18fb 100644 --- a/papers/GCCN_LES/gccn_rw_profs.py +++ b/papers/GCCN_LES/gccn_rw_profs.py @@ -16,40 +16,14 @@ # activate latex text rendering rc('text', usetex=True) # font size -plt.rcParams.update({'font.size': 24}) +plt.rcParams.update({'font.size': 10}) # fig size -plt.figure(figsize=(20,10)) +plt.figure(figsize=(7.2,4)) -# profs = ["gccn_rw_cl_down"] -# nplotx=1 -# nploty=1 -# -# # init the plot -# fig, axarr = plt.subplots(nplotx, nploty) -# print 'axarr type: ', type(axarr) -# print 'axarr shape: ', axarr.shape -# plot_iter=0 -# -# assert len(sys.argv) == 6 -# -# -# n_profs=3 -# file_names = [] -# file_labels = [] -# file_no = np.arange(1, 2 * n_profs , 2) # 2* because for each line there is data file and label -# for no in file_no: -# print no -# print sys.argv[no] -# file_names.append(sys.argv[no] + "profiles_7200_18000.dat") -# file_labels.append(sys.argv[no+1]) -# -# print file_names -# plot_iter = plot_profiles(profs, plot_iter, nplotx, nploty, axarr, xscaledict, yscaledict, xlimdict_series[cusc_iter], ylimdict_series, xlabel='Time [h]', file_names=file_names, file_labels=file_labels, linewidth=1.5) - -linestyles = ['--', '-.', ':'] +linestyles = ['-', '-.', '--'] dashList = [(3,1),(1,1),(4,1,1,1),(4,2)] -plt.xlabel('mean wet radius of droplets formed on aerosols with $r_\mathrm{dry}>2\mu\mathrm{m}$ [$\mu\mathrm{m}$]') +plt.xlabel('mean wet radius of droplets formed on aerosols with $r_\mathrm{dry}>2\, \mu\mathrm{m}$ [$\mu\mathrm{m}$]') plt.ylabel('height / inversion height') for no in [2,4,6]: @@ -60,8 +34,23 @@ profs_file.close() - plt.plot(my_gccn_rw, my_hgt, label=sys.argv[no+1]) + plt.plot(my_gccn_rw, my_hgt, label=sys.argv[no+1], ls=linestyles[int(no/2-1)]) plt.legend() plt.ylim(0,1.1) plt.savefig(sys.argv[1]) + +plt.clf() +for no in [2,4,6]: + file_name = sys.argv[no] + "profiles_7200_18000.dat" + profs_file = open(file_name, "r") + my_hgt = read_my_var(profs_file, "position") + my_gccn_rw = read_my_var(profs_file, "gccn_rw_cl_up") + + profs_file.close() + + plt.plot(my_gccn_rw, my_hgt, label=sys.argv[no+1]) + +plt.legend() +plt.ylim(0,1.1) +plt.savefig(sys.argv[1]+'updraft.pdf') diff --git a/papers/GCCN_LES/precip_vs_GCCN.py b/papers/GCCN_LES/precip_vs_GCCN.py index 3b75206..3c20d5f 100644 --- a/papers/GCCN_LES/precip_vs_GCCN.py +++ b/papers/GCCN_LES/precip_vs_GCCN.py @@ -18,7 +18,7 @@ profs_to_it = int(sys.argv[4]) qlimit = float(sys.argv[5]) -varlabels = ["{\it CuNc35}", "{\it CuNc55}", "{\it CuNc75}"] +varlabels = ["{\it Sc30}", "{\it Sc40\_salt\_CCN}", "{\it Sc45}", "{\it Sc105}"] averaging_period = float(profs_to_it - profs_from_it) / 3600. # period over which series are averaged [h]; NOTE: we assume that series_from(to)_it = profs_from(to)_it / outfreq! # assumed initial GCCN concentrations @@ -37,11 +37,11 @@ series_file_names.append(sys.argv[no] + "series.dat") profs_file_names.append(sys.argv[no] + "profiles_"+str(profs_from_it)+"_"+str(profs_to_it)+".dat") -assert(len(series_file_names) == 12) +assert(len(series_file_names) == 16) label_counter=0 -for it in np.arange(12): +for it in np.arange(16): if(it % 4 == 0): mean_surf_precip = [] tot_acc_surf_precip = [] diff --git a/papers/GCCN_LES/results_vs_CCN.py b/papers/GCCN_LES/results_vs_CCN.py index 1bbebb2..0cfd7f4 100644 --- a/papers/GCCN_LES/results_vs_CCN.py +++ b/papers/GCCN_LES/results_vs_CCN.py @@ -54,7 +54,7 @@ #axes = plt.gca() #axes.tick_params(direction='in') -labeldict=["{\it ScNc30}", "{\it ScNc45}", "{\it ScNc105}"] +labeldict=["{\it Sc30}", "{\it Sc45}", "{\it Sc105}"] y_arr = np.arange(nploty) for y in y_arr: #tics inside diff --git a/papers/ICMW2020_CC/compare_profs.py b/papers/ICMW2020_CC/compare_profs.py index cd53714..0987952 100644 --- a/papers/ICMW2020_CC/compare_profs.py +++ b/papers/ICMW2020_CC/compare_profs.py @@ -13,16 +13,20 @@ from plot_ranges import * from plot_profs import * -profs = ["cl_nc", "actrw_reff_cl", "cloud_std_dev"] +profs = ["cl_nc", "actrw_reff_cl", "cloud_std_dev", "rliq", "ratio_mean_volue_r_to_eff_r_cubed"] xlabels = { "cl_nc": "cloud droplet concentration [1/cc]", "actrw_reff_cl": "effective radius of cloud droplets [um]", - "cloud_std_dev": "std. dev. of radius of cloud droplets [um]" + "cloud_std_dev": "std. dev. of radius of cloud droplets [um]", + "rliq": "liquid water [g/kg]", + "ratio_mean_volue_r_to_eff_r_cubed": "(mean vol rad) / (eff rad) [1]" } xlims = { "cl_nc": [], "actrw_reff_cl": [], - "cloud_std_dev": [] + "cloud_std_dev": [], + "rliq": [], + "ratio_mean_volue_r_to_eff_r_cubed": [] } # activate latex text rendering