def pcent_vs_0psi(run, period_fac=1., lonin=[-1.,361.]): #Load in data, add area to dataset data = xr.open_dataset('/scratch/rg419/Data_moist/climatologies/' + run + '.nc') psi_edge = get_edge_psi(run, thresh=0., period_fac=period_fac) p_cent = precip_centroid(run, lat_bound = 45., lonin=lonin) plt.plot(p_cent.sel(xofyear=psi_edge[0].xofyear), psi_edge[0], 'xk', alpha=0.7) plt.xlabel('Precipitation centroid') plt.ylabel('Latitude of 0 mass streamfunction') plt.grid(True,linestyle=':') plt.ylim([-40,40]) plt.xlim([-40,40]) plt.savefig('/scratch/rg419/plots/aht_work/pcent_0psi_'+run+'.pdf', format='pdf') plt.close()
ax.get_yaxis().set_major_formatter(tk.ScalarFormatter()) plt.tight_layout() else: plt.ylim([0, int(latmax) + 5]) plt.xlim([0, int(psimax) + 50]) plt.savefig('/scratch/rg419/plots/regime_fig/' + plotname + '.pdf', format='pdf') plt.close() #vars_zs = get_edge_psi('zs_sst', thresh=thresh, lev=lev, sanity_check=True) #vars_co2 = get_edge_psi('ap10_co2', thresh=thresh, lev=lev, sanity_check=True) #vars_qflux = get_edge_psi('ap10_qflux', thresh=thresh, lev=lev, sanity_check=True) #vars_ap2 = get_edge_psi('ap_2', thresh=thresh, lev=lev) vars_ap10 = get_edge_psi('sn_1.000', thresh=thresh, lev=lev) #vars_ap20 = get_edge_psi('ap_20', thresh=thresh, lev=lev) #vars_full = get_edge_psi('full_qflux', thresh=thresh, lonin=[60.,150.], lev=lev) vars_sn05 = get_edge_psi('sn_0.500', thresh=thresh, lev=lev) vars_sn20 = get_edge_psi('sn_2.000', thresh=thresh, lev=lev) #vars_rt05 = get_edge_psi('rt_0.500', thresh=0., lev=lev) #vars_rt10 = get_edge_psi('sn_1.000', thresh=0., lev=lev) #vars_rt20 = get_edge_psi('rt_2.000', thresh=0., lev=lev) #vars = [vars_ap10] #plot_multiple(vars, 'mlds_10', s=['o'], psimin=200, psimax=470, latmax=25) #vars = [vars_ap10] #plot_multiple(vars, 'mlds_10_line', s=['o'], ll=[True], lh=[True], psimin=200, psimax=470, latmax=25) #vars = [vars_ap10, vars_co2, vars_qflux]
#import sh from data_handling import cell_area #from pylab import rcParams from physics import precip_centroid, model_constants as mc, mass_streamfunction, get_edge_psi import scipy.interpolate as spint from pylab import rcParams month_list = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] rcParams['figure.figsize'] = 10, 7 rcParams['font.size'] = 20 rcParams['text.usetex'] = True # Get data for steady state experiments intdown=True vars_90 = get_edge_psi('ss_90.000', thresh=0., intdown=intdown) vars_91 = get_edge_psi('ss_91.000', thresh=0., intdown=intdown) vars_92 = get_edge_psi('ss_92.000', thresh=0., intdown=intdown) vars_95 = get_edge_psi('ss_95.000', thresh=0., intdown=intdown) vars_100 = get_edge_psi('ss_100.000', thresh=0., intdown=intdown) vars_105 = get_edge_psi('ss_105.000', thresh=0., intdown=intdown) def plot_regime(vars, varcolor='k', shem=True): if shem: psi_max = vars[1]*-1. edge_loc = vars[0] else: psi_max = vars[1] edge_loc = vars[0]*-1.
plt.xlim([0, 40]) if not key_labels == None: plt.legend(handles=key_labels, loc='upper left', prop={'size': 18}, numpoints=1) plt.savefig('/scratch/rg419/plots/paper_1_figs/revisions/regimefig_' + plotname + '.pdf', format='pdf') plt.close() thresh = 120. lev = 500. vars_ap2 = get_edge_psi('ap_2', thresh=thresh, lev=lev, sanity_check=False) vars_ap10 = get_edge_psi('sn_1.000', thresh=thresh, lev=lev) vars_ap20 = get_edge_psi('ap_20', thresh=thresh, lev=lev, sanity_check=False) #vars_full_all = get_edge_psi('full_qflux', thresh=thresh, lev=lev)#, lonin=[60.,150.]) vars_full = get_edge_psi('full_qflux', thresh=thresh, lonin=[60., 150.], lev=lev) #, do_ageostrophic=True, sanity_check=True) #vars_full = get_edge_psi('full_qflux', thresh=thresh, lonin=[345.,45.], lev=lev) vars_era = get_edge_psi('era', lonin=[60., 150.], thresh=thresh, lev=lev, sanity_check=False) key_labels = [
# Load in data for steady state simulations and save average of years 11-15 in climatology folder. import numpy as np import xarray as xr import matplotlib.pyplot as plt from physics import get_edge_psi intdown=True vars_90 = get_edge_psi('ss_90.000', thresh=0., intdown=intdown) vars_95 = get_edge_psi('ss_95.000', thresh=0., intdown=intdown) vars_100 = get_edge_psi('ss_100.000', thresh=0., intdown=intdown) vars_105 = get_edge_psi('ss_105.000', thresh=0., intdown=intdown) vars_110 = get_edge_psi('ss_110.000', thresh=0., intdown=intdown) vars_115 = get_edge_psi('ss_115.000', thresh=0., intdown=intdown) plt.plot(vars_90[0], vars_90[1], 'xk', mew=2) plt.plot(vars_95[0], vars_95[1], 'xk', mew=2) plt.plot(vars_100[0], vars_100[1], 'xk', mew=2) plt.plot(vars_105[0], vars_105[1], 'xk', mew=2) plt.plot(vars_110[0], vars_110[1], 'xk', mew=2) plt.plot(vars_115[0], vars_115[1], 'xk', mew=2) plt.show()
rcParams['figure.figsize'] = 10, 7 rcParams['font.size'] = 20 rcParams['text.usetex'] = True # Get data for steady state experiments run_list = [ 'ss_90.000', 'ss_91.000', 'ss_92.000', 'ss_93.000', 'ss_94.000', 'ss_95.000', 'ss_100.000', 'ss_105.000' ] intdown = True ss_thresh = 0. ss_vars = [] for run in run_list: ss_vars.append(get_edge_psi(run, thresh=ss_thresh, intdown=intdown)) def plot_regime(vars, varcolor='k', shem=True, guide=10): # shem specfies whether northern or southern hemisphere is being plotted # guide helps in locaton of outward and return branch, selected for shem=True if shem: psi_max = vars[1] * -1. edge_loc = vars[0] else: psi_max = vars[1] edge_loc = vars[0] * -1. i = int(vars[0][guide:].argmax('xofyear')) + guide j = int(vars[0].argmin('xofyear')) #print j, i
# Load in data for steady state simulations and save average of years 11-15 in climatology folder. import numpy as np import xarray as xr import matplotlib.pyplot as plt import matplotlib.ticker as tk from physics import get_edge_psi intdown = True lonin = [-1., 361.] vars_0_100 = get_edge_psi('qflux_0_100', lonin=lonin, thresh=0., intdown=intdown) vars_5_100 = get_edge_psi('qflux_5_100', lonin=lonin, thresh=0., intdown=intdown) vars_10_100 = get_edge_psi('qflux_10_100', lonin=lonin, thresh=0., intdown=intdown) vars_15_100 = get_edge_psi('qflux_15_100', lonin=lonin, thresh=0., intdown=intdown) vars_20_100 = get_edge_psi('qflux_20_100', lonin=lonin, thresh=0.,
#from pylab import rcParams from physics import precip_centroid, model_constants as mc, mass_streamfunction, get_edge_psi import scipy.interpolate as spint from pylab import rcParams month_list = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] rcParams['figure.figsize'] = 10, 7 rcParams['font.size'] = 20 rcParams['text.usetex'] = True # Get data for steady state experiments intdown=True ss_thresh = 0. vars_90 = get_edge_psi('ss_90.000', thresh=ss_thresh, intdown=intdown) vars_91 = get_edge_psi('ss_91.000', thresh=ss_thresh, intdown=intdown) vars_92 = get_edge_psi('ss_92.000', thresh=ss_thresh, intdown=intdown) vars_95 = get_edge_psi('ss_95.000', thresh=ss_thresh, intdown=intdown) vars_100 = get_edge_psi('ss_100.000', thresh=ss_thresh, intdown=intdown) vars_105 = get_edge_psi('ss_105.000', thresh=ss_thresh, intdown=intdown) def plot_regime(vars, varcolor='k', shem=True, guide=10): if shem: psi_max = vars[1]*-1. edge_loc = vars[0] else: psi_max = vars[1] edge_loc = vars[0]*-1.