Example #1
0
                             cmap,
                             pcolor=0,
                             ax=axs[mode])
        axs[mode].set_title("MLD %s" % modelname[mode], fontsize=12)
    #plt.suptitle("AMV Pattern | Forcing: %s; fscale: %ix" % (forcingname[funiform],fscale),ha='center')
    #fig.tight_layout(rect=[0, 0.03, .75, .95])
    outname = outpath + 'AMVpattern_%s_allmodels.png' % (expid)
    plt.savefig(outname, bbox_inches="tight", dpi=200)

    #%Make AMV Time Plots
    xlm = [24, 240]
    ylm = [-0.5, 0.5]
    #xtk = np.arange(xlm[0],xlm[1]+20,20)
    fig, axs = plt.subplots(1, 4, figsize=(12, 1.5))
    for mode in range(4):
        viz.plot_AMV(amvidx[mode], ax=axs[mode])
        axs[mode].set_title("MLD %s" % modelname[mode], fontsize=12)
        axs[mode].set_xlim(xlm)
        #axs[mode].set_xticks(xtk)
        axs[mode].set_xlabel('Year')
        #axs[mode].set_ylim(ylm)
    axs[0].set_ylabel('AMV Index')
    #plt.suptitle("AMV Index | Forcing: %s; fscale: %ix" % (forcingname[funiform],fscale))
    #fig.tight_layout(rect=[0, 0.03, 1, 0.95])
    outname = outpath + 'AMVIndex_%s_allmodels.png' % (expid)
    plt.savefig(outname, bbox_inches="tight", dpi=200)

    #% Compute Autocorrelatioin for each region
    start = time.time()
    kmonths = {}
    autocorr_region = {}
Example #2
0
            axs[mode].set_title("%s" % modelname[mode], fontsize=12)
        #plt.suptitle("AMV Pattern | Forcing: %s; fscale: %ix" % (forcingname[funiform],fscale),ha='center')
        #fig.tight_layout(rect=[0, 0.03, .75, .95])
        outname = outpathfig + 'AMVpattern_%s_allmodels_region%s.png' % (
            expid, regions[region])
        plt.savefig(outname, bbox_inches="tight", dpi=200)

        #%Make AMV Time Plots
        xlm = [24, 240]
        ylm = [-0.5, 0.5]

        #xtk = np.arange(xlm[0],xlm[1]+20,20)
        fig, axs = plt.subplots(1, 4, figsize=(12, 1.5))
        for mode in range(4):

            viz.plot_AMV(invar2[f, region, mode, :], ax=axs[mode])
            axs[mode].set_title("MLD %s" % modelname[mode], fontsize=12)
            axs[mode].set_xlim(xlm)
            #axs[mode].set_xticks(xtk)
            axs[mode].set_xlabel('Year')
            #axs[mode].set_ylim(ylm)
        axs[0].set_ylabel('AMV Index')
        #plt.suptitle("AMV Index | Forcing: %s; fscale: %ix" % (forcingname[funiform],fscale))
        #fig.tight_layout(rect=[0, 0.03, 1, 0.95])
        outname = outpathfig + 'AMVIndex_%s_allmodels_region%s.png' % (
            expid, regions[region])
        plt.savefig(outname, bbox_inches="tight", dpi=200)
#%% Create individual AMV Plots

invar = amvsp.mean(0)  #[5 x 4 x 4 x 97 x 117]
invar2 = amvid.mean(0)
Example #3
0
                #axs[mode].set_title("MLD %s" % modelname[mode],fontsize=12)
                axs[mode].set_title("%s" % modelname[mode],fontsize=12)

            outname = outpathfig+'%s_AMVpattern_%s_allmodels_vscale%i.png' % (regions[region],expid,vscale)
            plt.savefig(outname, bbox_inches="tight",dpi=200)
            
            
            #%Make AMV Time Plots
            xlm = [24,240]
            ylm = [-0.5,0.5]
            
            #xtk = np.arange(xlm[0],xlm[1]+20,20)
            fig,axs = plt.subplots(1,4,figsize=(12,1.5))
            for mode in range(4): 
                
                viz.plot_AMV(amvidx[region][mode]*vscale,ax=axs[mode])
                axs[mode].set_title("%s" % modelname[mode],fontsize=12)
                axs[mode].set_xlim(xlm)
                #axs[mode].set_xticks(xtk)
                axs[mode].set_xlabel('Year')
                axs[mode].set_ylim(ylm)
            axs[0].set_ylabel('AMV Index')
            #plt.suptitle("AMV Index | Forcing: %s; fscale: %ix" % (forcingname[funiform],fscale))
            #fig.tight_layout(rect=[0, 0.03, 1, 0.95])
# <<<<<<< Updated upstream
#             outname = outpathfig+'%s_AMVIndex_%s_allmodels_region%s.png' % (regions[region],expid)
# =======
            #plt.tight_layout()
            outname = outpathfig+'%s_AMVIndex_%s_allmodels_vscale%i.png' % (regions[region],expid,vscale)
# >>>>>>> Stashed changes
            plt.savefig(outname, bbox_inches="tight",dpi=200)
Example #4
0
#%%
# -------------------------------
# Plot AMV from the 4 experiments
# -------------------------------

xrange = [100,300]
htimeall = np.arange(0,len(amv[1]))
hticks = np.arange(0,1100,100)
fig,ax = plt.subplots(4,1,sharex=True,sharey=True,figsize=(4,8))
for mode in range(4):
    plt.style.use("ggplot")
    
    plt.subplot(4,1,mode+1)
    
    #plt.plot(htimeall,aa[mode],color=[0.75,0.75,0.75])
    viz.plot_AMV(amv[mode])
    
    
    
    #plt.ylim([-1.5,1.5])
    #plt.xticks(np.arange(0,len(amv[1])+1200,1200),hticks,fontsize=16)
    #plt.yticks(np.arange(-1.5,2.0,0.5),fontsize=16)
    plt.title("AMV Index for %s" % hvarnames[mode],fontsize=12)
    plt.xlim(xrange)
    maxval = np.max(np.abs(amv[mode]))
    plt.ylim([maxval*-1,maxval])
    #ax[mode+1].tick_params(labelsize=16)

    

    
Example #5
0
plt.legend(fancybox=True,shadow=True,loc='upper center')
#leg = ax.legend([l1,l2,l3,l4],labels=regions,ncol=4,bbox_to_anchor=(0, -0.1),loc='upper left')
#leg(fancybox=True,shadow=True)
#ax.legend([l1,l2,l3,l4],labels=regions,ncol=4,bbox_to_anchor=(-0.1, 1.1),loc='upper left')

outname = '%sHadISST_AMVpattern_%s-%s_dtmethod%i_TROOnly.png' % (outpath,startyr,hyr[0,-1],method)
plt.savefig(outname, bbox_inches="tight",dpi=200)



#%% Plot AMV INdex

xtks = np.arange(0,140,20)
xtkl = np.arange(startyr,startyr+140,20)
fig,ax = plt.subplots(1,1,figsize=(5,1))
ax = viz.plot_AMV(h_amv,ax=ax)
ytks = np.arange(-0.5,0.75,0.25)
    
ax.set_xticks(xtks)
ax.set_xticklabels(xtkl)
ax.set_ylim(-.5,.5)
ax.set_yticks(ytks)
ax.set_title("HadISST AMV Index (%s to %s)" % (startyr,hyr[0,-1]),fontsize=10) 
outname = '%sHadISST_AMVIDX_%s-%s_dtmethod%i.png' % (outpath,startyr,hyr[0,-1],method)
plt.savefig(outname, bbox_inches="tight",dpi=200)
    

#%% UPDATE (MAY 24th 2021, Plots for Generals Presentation)

def plot_AMV_generals(lat,lon,amvpattern,vscale=1):
    """