def contour_plot(field,clevs,lats,lons,title_fontsize=20,title='',cmap='RdBu_r'): m = make_plots.make_map_plot() #ax.add_feature(cfeature.LAND) cs = m.add_filled_contours(lons,lats,field,clevs,cmap=cmap) plt.title(title,fontsize=title_fontsize) ax.coastlines() #ax.add_feature(cfeature.LAND) return cs
def contour_plot(field, clevs, lats, lons, title_fontsize=35, title='', cmap='RdBu_r', extent=[50, 290, -30, 60]): plt.title(title, fontsize=title_fontsize) m = make_plots.make_map_plot() cs = m.add_filled_contours(lons, lats, field, clevs, cmap=cmap) make_plots.add_lat_lon(ax) m.geography(ax, extent=extent) ax.set_aspect(1.5) #ax.set_extent(extent) return cs
def contour_plot(field, clevs, lats, lons, climatology=None, clim_clevs=None, lats_ua=None, lons_ua=None, calculate_significance=True, title_fontsize=20, title='', cmap='RdBu_r', extent=[0, 359.99, -10, 60], plot_box=False): #[60,210,0,60] m = make_plots.make_map_plot() if calculate_significance == True: pvals = t_test_autocorr(data_all, data_all[mask, :, :], autocorr=0) field = np.mean(data_all[mask], axis=0) cs = m.add_filled_contours(lons, lats, field, clevs, cmap=cmap) plt.contour(lons, lats, pvals, np.array([0.05]), colors='k', transform=ccrs.PlateCarree()) title = title + ' (' + str(data_all[mask].shape[0]) + ')' else: cs = m.add_filled_contours(lons, lats, field, clevs, cmap=cmap) if climatology is not None: plt.contour(lons_ua, lats_ua, climatology, clim_clevs, colors='0.75', transform=ccrs.PlateCarree()) if plot_box == True: plt.plot([70, 150], [20, 20], color='k', transform=ccrs.PlateCarree()) plt.plot([70, 150], [50, 50], color='k', transform=ccrs.PlateCarree()) plt.plot([70, 70], [20, 50], color='k', transform=ccrs.PlateCarree()) plt.plot([150, 150], [20, 50], color='k', transform=ccrs.PlateCarree()) plt.title(title, fontsize=title_fontsize) make_plots.add_lat_lon(ax) m.geography(ax, extent=extent) ax.set_aspect(1.5) return cs
def contour_plot(row, column, field, clevs, lats, lons, data_all, mask, climatology=None, clim_clevs=None, calculate_significance=True, title_fontsize=35, title='', cmap='RdBu_r', extent=[50, 290, -30, 60]): ax = plt.subplot(gs[row, column], projection=ccrs.PlateCarree(central_longitude=180.)) m = make_plots.make_map_plot() if calculate_significance == True: pvals = t_test_autocorr(data_all, data_all[mask, :, :], autocorr=0) field = np.mean(data_all[mask], axis=0) cs = m.add_filled_contours(lons, lats, field, clevs, cmap=cmap) plt.contour(lons, lats, pvals, np.array([0.05]), colors='k', transform=ccrs.PlateCarree()) title = title + ' (' + str(data_all[mask].shape[0]) + ')' else: cs = m.add_filled_contours(lons, lats, field, clevs, cmap=cmap) if climatology is not None: plt.contour(lons, lats, climatology, clim_clevs, colors='0.75', transform=ccrs.PlateCarree()) plt.title(title, fontsize=title_fontsize) make_plots.add_lat_lon(ax) m.geography(ax, extent=extent) ax.set_aspect(1.5) return cs
def plot_reg(ax, field, lats, lons, clevs, field2=None, clevs2=None, title='', title_fontsize=30, extent=[10, 220, 0, 70], pvals=None): """ Plot the regression patterns """ plt.title(title, fontsize=title_fontsize) m = make_plots.make_map_plot() cs = m.add_filled_contours(lons, lats, field, clevs) if field2 is not None: m.add_contours(lons, lats, field2, clevs2) make_plots.add_lat_lon(ax, fontsize=15) m.geography(ax, extent=[30, 330, -15, 70]) #make_plots.plot_box(lon_min=110,lon_max=180,lat_min=20,lat_max=50) ax.set_aspect(2) return cs
def plot_mode(ax, field1, field2, lats, lons, clevs, clevs2, title='', title_fontsize=30, extent=[10, 220, 0, 70], pvals=None): """ Plot the EOF patterns """ plt.title(title, fontsize=title_fontsize) m = make_plots.make_map_plot() cs = m.add_filled_contours(lons, lats, field1, clevs) m.add_contours(lons, lats, field2, clevs2, contour_labels=False) make_plots.add_lat_lon(ax) m.geography(ax, extent=[10, 220, 0, 70]) make_plots.plot_box(lon_min=110, lon_max=180, lat_min=20, lat_max=50) ax.set_aspect(2) return cs