# Correct for topography u_orig = u u = correct_for_topography(u_orig, topo) m, k = 3, 1 plt.figure(figsize=(7, 8)) plt.subplot(211) ap.pcolor_latlon(u_orig[m, k], cmap='jet') plt.subplot(212) ap.pcolor_latlon(u[m, k], cmap='jet') # ---------------------------------------------------------------------- # Zonal mean zonal wind season = 'jjas' lon1, lon2 = 60, 100 cint = 5 months = utils.season_months(season) uplot = dat.subset(u, 'lon', lon1, lon2, 'mon', months) uplot = uplot.mean(['lon', 'mon']) ps_plot = dat.subset(topo, 'lon', lon1, lon2) ps_plot = ps_plot.mean('lon') plt.figure() ap.contour_latpres(uplot, clev=cint, topo=ps_plot) plt.figure() ap.contourf_latpres(uplot, clev=cint, topo=ps_plot)
u_orig = u u = correct_for_topography(u_orig, topo) m, k = 3, 1 plt.figure(figsize=(7,8)) plt.subplot(211) ap.pcolor_latlon(u_orig[m,k], cmap='jet') plt.subplot(212) ap.pcolor_latlon(u[m,k], cmap='jet') # ---------------------------------------------------------------------- # Zonal mean zonal wind season='jjas' lon1, lon2 = 60, 100 cint = 5 months = utils.season_months(season) uplot = dat.subset(u, 'lon', lon1, lon2, 'mon', months) uplot = uplot.mean(['lon', 'mon']) ps_plot = dat.subset(topo, 'lon', lon1, lon2) ps_plot = ps_plot.mean('lon') plt.figure() ap.contour_latpres(uplot, clev=cint, topo=ps_plot) plt.figure() ap.contourf_latpres(uplot,clev=cint, topo=ps_plot)
lat = get_coord(u, 'lat') lon = get_coord(u, 'lon') plev = get_coord(u, 'plev') topo = dat.get_ps_clim(lat, lon) / 100 topo.units = 'hPa' # ---------------------------------------------------------------------- # Initial plots ubar = u.mean(axis=-1) vbar = v.mean(axis=-1) plt.figure(figsize=(7,8)) plt.subplot(211) ap.contour_latpres(ubar, clev=5) plt.subplot(212) ap.contour_latpres(vbar, clev=0.5) t, k = 0, 4 plt.figure(figsize=(7,8)) plt.subplot(211) ap.pcolor_latlon(u[t,k]) plt.subplot(212) ap.pcolor_latlon(v[t,k]) # ---------------------------------------------------------------------- # Moisture fluxes uq = u * q vq = v * q
plev_new = np.arange(1000,0,-25.) # DataArray u_i = interp_plevels(u, plev_new, pdim=-3) # ndarray u_i2 = interp_plevels(u, plev_new, plev, pdim=-3) m, i, j = 0, 35, 70 cint=5 plt.figure(figsize=(7,8)) plt.subplot(211) plt.plot(u[m,:,i,j], plev, 'b.-') plt.plot(u_i[m,:,i,j], plev_new, 'r*') plt.gca().invert_yaxis() plt.subplot(212) plt.plot(u[m,:,i,j], plev, 'b.-') plt.plot(u_i2[m,:,i,j], plev_new, 'r*') plt.gca().invert_yaxis() plt.draw() plt.figure(figsize=(7,10)) plt.subplot(311) ap.contour_latpres(u[m,:,:,j], clev=cint) plt.subplot(312) ap.contour_latpres(u_i[m,:,:,j], clev=cint) plt.subplot(313) ap.contour_latpres(u_i2[m,:,:,j], lat, plev, clev=cint)