comp_yrs[key1], comp_yrs[key2] = lowest_highest(enso, nyrs) atm.print_odict(comp_yrs) # ====================================================================== # PLOTS # ====================================================================== # ---------------------------------------------------------------------- if plot_all_years: # --- Daily timeseries plots together (day of year) style = {onset_nm : 'k', onset_nm + '_clim' : 'k--', 'MFC' : 'b'} onset_style = {onset_nm : 'k'} d_onset = {onset_nm : onset.values} keys = [onset_nm, onset_nm + '_clim', 'MFC'] indices.plot_tseries_together(tseries[keys], onset=d_onset, data_style=style, onset_style=onset_style, show_days=True) # --- Daily timeseries composites relative to onset day - clim +/- 1 stdev keys = [onset_nm, 'MFC'] npre, npost = 30, 90 ts_rel = xray.Dataset() for key in keys: ts_rel[key] = daily_rel2onset(tseries[key], onset, npre, npost, yearnm='year', daynm='day') dayrel = ts_rel['dayrel'].values offset, factor = {}, {} for key in keys: offset[key] = -np.nanmean(tseries[key].values.ravel()) factor[key] = np.nanstd(tseries[key].values.ravel())
# The north region should go up to 35 N but there is some weirdness # with the topography so I'm setting it to 30 N for now north=(5, 30, 40, 100) south=(-15, 5, 40, 100) suptitle = varname + ' N=%s S=%s' % (str(north), str(south)) tt = onset_TT(T, north=north, south=south) # Some weirdness going on in 1991, for now just set to NaN # Troubleshoot later for nm in ['ttn', 'tts', 'tseries']: vals = tt[nm].values vals = np.ma.masked_array(vals, abs(vals) > 1e30).filled(np.nan) tt[nm].values = vals # Plot TTN and TTS plot_tseries_together(tt[['ttn', 'tts']], tt['onset'].values, suptitle=suptitle, standardize=False) # Summary plot and timeseries in individual years summarize_indices(years, tt['onset']) plt.suptitle(suptitle) plot_index_years(tt, suptitle=suptitle, yearnm='year', daynm='day') if save: atm.savefigs(varname + '_', 'png') # Plot contour map of pressure-level data p_plot = 400 T_plot = T_p[p_plot] y, d = 0, 80 lat = atm.get_coord(T_plot, 'lat') lon = atm.get_coord(T_plot, 'lon')