コード例 #1
0
ファイル: viz_AMV_CESM.py プロジェクト: glennliu265/stochmod
def lin_quickformat(ax, plotdt, freq):
    # Set tickparams and clone
    xtick = np.arange(0, 1.7, .2)
    ax.set_xticks(xtick)
    ax.set_ylabel("Power ($\degree C^{2} / cpy$)", fontsize=12)
    ax.set_xlabel("Frequency (cycles/year)", fontsize=12)
    htax = viz.twin_freqaxis(ax,
                             freq,
                             "Years",
                             dt,
                             mode='lin-lin',
                             xtick=xtick)

    # Set xtick labels
    xtkl = ["%.1f" % (1 / x) for x in xtick]
    htax.set_xticklabels(xtkl)

    # Set some key lines
    ax = viz.add_yrlines(ax, dt=plotdt)

    ax.legend(fontsize=10)
    return ax, htax
コード例 #2
0
                (np.std(sstin[i])),
                color=ecol[i],
                ls="solid",
                lw=1)
    #ax.semilogx(freqs[i],freqs[i]*)

ax.semilogx(freqcesmslab,
            freqcesmslab * Pcesmslab,
            color='gray',
            label="CESM1 SLAB" + "$\; (\sigma=%.2f ^{\circ}C$)" %
            (np.std(slabpt)))
#ax.semilogx(freqcesmfull,freqcesmfull*Pcesmfull,color='black')

ax.legend(fontsize=10)

htax = viz.twin_freqaxis(ax, freqs[0], tunit, dt)
ax.set_ylabel(r"Frequency x Power $(^{\circ}C)^{2}$", fontsize=13)

#ax,htax = formatspec_generals(ax,htax)

#ax.axvline([1/(dt*12*1.6)],color='r')

ax.set_title("SST Spectral Estimates, Non-Entraining Stochastic Model")
plt.tight_layout()
plt.savefig("%sSpectra_ConstvVary_MLDConst_SamePlot.png" % outpath, dpi=150)

#%% Save the results to visualize in another script (plot_spectra_Generals)
outdatname = datpath + "/Generals_Report/lower_hierarchy_data_nsmooth%i.npz" % (
    nsmooth)
np.savez(outdatname,
         **{
コード例 #3
0
ファイル: viz_AMV_CESM.py プロジェクト: glennliu265/stochmod
        color='black',
        label="CESM1 FULL AR1 95% Significance",
        ls='dashed')
ax.plot(freqcesmfull * plotdt,
        CLs[0][:, 0] / plotdt,
        color='black',
        label="CESM1 FULL AR1",
        ls=':')
#ax,htax = lin_quickformat(ax,plotdt,freqcesmfull)
ax.set_xlabel("")
ax.set_title("CESM1 NASSTI (SLAB vs. FULL) \n nsmooth=%i" % (nsmooths[0]))

ax.set_xlim(xlms)
ax.set_xticks(xtks)
xtick = np.array(xtks)
htax = viz.twin_freqaxis(ax, freq, "Years", dt, mode='lin-lin', xtick=xtick)
# Set xtick labels
htax.set_xticklabels(xtkl)

ax.set_ylim([0, 1])

ax.legend(fontsize=10)

plt.tight_layout()
plt.savefig(
    "%sNASSTI_SpectralEstimate_nsmooth%i_taper%i_decadal_timemax%i.png" %
    (outpath, nsmooths[i], pct * 100, timemax),
    dpi=200)

#%% Remake the plot (variance preserving)
コード例 #4
0
                ls='dashed')
    ax.semilogx(freqs[i] * plotdt,
                CCs[i][:, 0] * freqs[i],
                color=ecolors[i],
                alpha=0.5,
                ls='dotted')

# Set x limits
xtick = ax.get_xticks()

# Set Labels
ax.set_ylabel("Frequency x Power ($\degree C^{2}$)", fontsize=12)
ax.set_xlabel("Frequency (cycles/year)", fontsize=12)
htax = viz.twin_freqaxis(ax,
                         freqs[1],
                         "Years",
                         plotdt,
                         mode='log-lin',
                         xtick=xtick)

xlm = [5e-4, 10]
ax.set_xlim(xlm)
htax.set_xlim(xlm)
ylm = [-.01, .4]

# Set xtick labels
xtkl = ["%.1f" % (1 / x) for x in xtick]
htax.set_xticklabels(xtkl)

ax.set_title("SST Spectral Estimates at %s" % (locstringtitle))
plt.tight_layout()
plt.savefig(outpath +