def plot_whitenoise(ts, ax, nsmooth=1000, pct=0.10, dt=3600 * 24 * 30): tsvar = np.std(ts) wn = np.random.normal(0, tsvar, len(ts)) sps = ybx.yo_spec(wn, 1, nsmooth, pct, debug=False) P, freq, dof, r1 = sps P *= dt freq /= dt ax.semilogx(freq, freq * P, label="White Noise ($\sigma=%.2f ^{\circ}C)$" % (tsvar), color='blue', lw=0.5) return ax, P, freq
clopt = 1 # Retrieve point lonf, latf = config['query'] if lonf < 0: lonf += 360 klon360, klat = proc.find_latlon(lonf, latf, lon360, lat) fullpt = sstfull[:, klat, klon360] slabpt = sstslab[:, klat, klon360] # Calculate spectra freq1s, P1s, CLs = [], [], [] for i, sstin in enumerate([fullpt, slabpt]): # Calculate and Plot sps = ybx.yo_spec(sstin, opt, nsmooths[i], pct, debug=False) P, freq, dof, r1 = sps # Plot if option is set if plotcesm: pps = ybx.yo_specplot(freq, P, dof, r1, tunit, dt=dt, clvl=clvl, axopt=axopt, clopt=clopt) fig, ax, h, hcl, htax, hleg = pps #ax,htax = viz.make_axtime(ax,htax)