####################################################################################################################### if r!=0: #Masks out for STD if (len(np.std(original_obs, axis=1)[(np.std(original_obs, axis=1))< 0.03e12])!=0): print ("STD mask in effect") for i in range(len(auto)): if np.std(original_obs, axis=1)[i] < 0.03e12: boot_auto[i,:]=-1 # 0 will be seen as significant auto[i,:]=0 #%% fig, ax = plt.subplots(figsize=(4,9)) if pstyle == "pc": #pcparams=dict(clevs=np.arange(-0.15,1.05,0.1),cmap='acccbar') #CCCMA pcparams=dict(clevs=np.arange(-0.8,1,0.1),cmap=jet3) #Mitch's pc=rpl.add_pc(ax,range(13),range(37),auto.transpose(),**pcparams) elif pstyle == "cf": pcparams=dict(clevs=np.arange(-0.8,1,0.1),cmap=jet3,latlon=False) pc=rpl.add_cf(ax,range(1,13),range(1,37),auto.transpose(),**pcparams) for month in range(len(boot_auto[:,0])): for lead in range(len(boot_auto[0,:])): if boot_auto[month,lead]>0: #MUST BE CHANGED BACK to >=!!!!!! plt.scatter((month+0.5),(lead+0.5), color = 'black', s=20) plt.title("%s Obs AutoCorr" % region_titles[(r-1)], fontsize=16) plt.colorbar(pc) ax.invert_xaxis ax.invert_yaxis ax.set_xticks(np.arange(len(calendar.month_name[1:13]))+0.5) ax.set_xticklabels(calendar.month_name[1:13], rotation=90) ax.set_yticks(np.arange(36)+0.5)
Created on Sat Feb 20 12:51:48 2021 @author: josmarti """ import rms_plots as rpl import numpy as np from matplotlib import colors import matplotlib.pyplot as plt import calendar version = raw_input("Version?\n") skill = np.load('/home/josmarti/Data/GeoACC_%s.npy' % version, allow_pickle=True).astype(float) ACC = np.nanmean(np.nanmean(skill, axis=2), axis=2) rpl.register_rms_cmaps() fig, ax = plt.subplots() pcparams = dict(clevs=np.arange(-0.15, 1.05, 0.1), cmap='acccbar') pc = rpl.add_pc(ax, range(13), range(13), ACC, **pcparams) plt.colorbar(pc) plt.title("ACC Means for %s" % version) ax.invert_xaxis ax.invert_yaxis ax.set_xticks(np.arange(len(calendar.month_name[1:13])) + 0.5) ax.set_xticklabels(calendar.month_name[1:13], rotation=90) ax.set_yticks(np.arange(len(calendar.month_name[1:13])) + 0.5) ax.set_yticklabels( ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11']) plt.xlabel("Predicted Month") plt.ylabel("Lead (Months)") plt.show()
np.std(pm_std, axis=1)[(np.std(pm_std, axis=1) * 1e15) / np.sum(area) < 0.8]) != 0 and std_mask): print("Perfect STD mask in effect") for i in range(len(auto)): if ((np.std(pm_std, axis=1)[i] * 1e15) / np.sum(area)) < 0.8: boot_auto[i, :] = -1 # 0 will be seen as significant auto[i, :] = 0 if auto_corr: fig, ax = plt.subplots(figsize=(4, 9)) if pstyle == "pc": #pcparams=dict(clevs=np.arange(-0.15,1.05,0.1),cmap='acccbar') #CCCMA pcparams = dict(clevs=np.arange(-0.8, 1, 0.1), cmap=jet3) #Mitch's pc = rpl.add_pc(ax, range(13), range(37), auto.transpose(), **pcparams) elif pstyle == "cf": pcparams = dict(clevs=np.arange(-0.15, 1.05, 0.1), cmap='acccbar', latlon=False) pc = rpl.add_cf(ax, range(1, 13), range(1, 37), ACC, **pcparams) for month in range(len(boot_auto[:, 0])): for lead in range(len(boot_auto[0, :])): if boot_auto[month, lead] > 0: #MUST BE CHANGED BACK to >=!!!!!! plt.scatter((month + 0.5), (lead + 0.5), color='black', s=20) if thesis_figures: plt.title("%s Obs" % region_titles[r], fontsize=16) else: if r != 0: plt.title("%s Detrended Obs Autocorrelation" % region, fontsize=16) else: