示例#1
0
                #plt.fill_between(xx,y1=minthresh,y2=diff,where=diff<=minthresh,color='b')
                ax.set_title(field + ' ' + region + ' ' + skey + ' ' + sea)

                ax=axs[1]
                nnhi,binshi,patcheshi = ax.hist(high.compressed(),color='r',alpha=0.5,normed=True,histtype='stepfilled')
                nnlo,binslo,patcheslo = ax.hist(low.compressed(),color='b',alpha=0.5,normed=True,histtype='stepfilled')
                nntot,binstot,patchestot = ax.hist(diff,color='0.5',alpha=0.5,normed=True,histtype='stepfilled')

    else:

        # Plot pvals for mean anomaly and standard dev
        # @@ for some reason if all sims are in dataframe, only some are plotted..??
        fig,axs=plt.subplots(1,2)
        fig.set_size_inches(12,4)
        ax=axs[0]
        tpvaldft.plot(linestyle='None',color=ccm.get_colordict().values(),marker='s',markersize=6,ax=ax)
        ax.axhline(y=siglevel,color='k')
        ax.set_ylabel('PVAL of T statistic for mean')
        ax.set_title(fdict['fieldstr'] + ' ' + region)
        ax.set_ylim((0,1))

        ax=axs[1]
        fpvaldft.plot(linestyle='None',colors=ccm.get_colordict().values(),marker='s',markersize=6,ax=ax)#make legend better@@
        ax.axhline(y=0.05,color='k')
        ax.set_ylabel('PVAL of F statistic for variance')
        ax.set_title(fdict['fieldstr'] + ' ' + region)
        ax.set_ylim((0,1))

        if printtofile:
            fig.savefig(fdict['fieldstr']+'_ftpvals' + savestr + '_' + region + '.pdf')
        tmp = np.squeeze(flddsea[seaii,lat>latlim,...])
        tmpcmp = np.squeeze(flddcsea[seaii,lat>latlim,...])
        pcsea[seaii] = cutl.pattcorr(tmp.flatten()*weights.flatten(),
                                     tmpcmp.flatten()*weights.flatten())
        pcsea2[seaii],pcsea2pval[seaii] = cutl.pattcorr_pearson(tmp.flatten()*weights.flatten(),
                                                                tmpcmp.flatten()*weights.flatten())
        
    
    seadiffdict[skey] = flddsea        
    pcseameandict[skey] = pcsea
    pcsea2meandict[skey] = pcsea2
    pcsea2pvalmeandict[skey] = pcsea2pval


colordict = ccm.get_colordict()

# <codecell>

import pandas as pd

pcmeandf = pd.DataFrame(pcmeandict)
ensmax = pcmeandf.max(axis=1)
ensmin = pcmeandf.min(axis=1)
ensrng = ensmax-ensmin
ensmean = pcmeandf.mean(axis=1)
## # for the purposes of calculating the internal var
## #   probably need to take average of the absolute value of corr
## pcmeandfabs = np.abs(pcmeandf)
## ensmeanabs = pcmeandfabs.mean(axis=1)