1.01, ctitle, horizontalalignment='left', verticalalignment='bottom', size=7, transform=ax.transAxes) hp = ax.imshow(lv, vmin=vmin, vmax=vmax, cmap='jet_r', alpha=1.0, extent=[xmin, xmax, ymin, ymax]) au.polyline_plot(ax, hydrography, '0.25') au.point_plot(ax, salinity_struc, marker='o', markersize=3, markeredgecolor='red', markerfacecolor='red') au.point_plot(ax, df_struc, marker='s', markersize=3, markeredgecolor='blue', markerfacecolor='white') au.point_plot(ax, pws, marker='o', markersize=1, markeredgecolor='black', markerfacecolor='black') au.point_plot(ax,
def plotData( cyear, cunits, ib, d_avg, f_text, d_text, metlevels, metcmap, \ xmin, xmax, ymin, ymax, vmin, vmax, \ hydrography, salinity_struc, df_struc, pws ): for jdx in xrange(0, len(d_text)): #-Make figures output_name = os.path.join(OutputDir, '{0}_{1}.png'.format(f_text[jdx], cyear)) print 'creating figure...{0}'.format(output_name) ztf = figure(figsize=(4.4, 6), facecolor='w') ztf.subplots_adjust(wspace=0.2, hspace=0.2, left=0.05, right=0.95, bottom=0.05, top=0.95) ax = ztf.add_subplot(1, 1, 1, aspect='equal') ctitle = '{0} {1}'.format(d_text[jdx], cyear) ax.text(0.0, 1.01, ctitle, horizontalalignment='left', verticalalignment='bottom', size=7, transform=ax.transAxes) temp = arr2dmask(ib, d_avg[jdx, :, :]) temp = arr2dmaskzero(temp) hp = ax.imshow(temp, cmap=metcmap[jdx], vmin=vmin[jdx], vmax=vmax[jdx], alpha=1.0, extent=[xmin, xmax, ymin, ymax], interpolation='None') au.polyline_plot(ax, hydrography, '0.25') au.point_plot(ax, salinity_struc, marker='o', markersize=3, markeredgecolor='black', markerfacecolor='red') au.point_plot(ax, df_struc, marker='s', markersize=3, markeredgecolor='black', markerfacecolor='cyan') au.point_plot(ax, pws, marker='o', markersize=1, markeredgecolor='black', markerfacecolor='black') ch = ax.contour(xcell, ycell, np.flipud(temp), levels=metlevels, colors='k', linewidths=0.5) ax.clabel(ch, inline=1, fmt='%3d', fontsize=6) #--colorbar cax = axes([0.740, 0.065, 0.025, 0.20]) colorbar(hp, cax=cax, orientation='vertical') cax.set_title(cunits, size=8) #--plot limits ax.set_xlim(xmin, xmax), ax.set_ylim(ymin, ymax) #--save the figure ztf.savefig(output_name, dpi=300) #--clear memory mpl.pyplot.close('all') gc.collect() #--return return (True)
sw2 = np.flipud(sw2) sw3 = np.flipud(sw3) #--calculate current date and create string of date on_date = start_date + timedelta(days=on_time) cdate = datetime.strftime( on_date, '%m/%d/%Y' ) #-Make figures #--saltwater interface figure output_name = os.path.join( OutputDir, 'Zeta_{0:05d}.png'.format( int( iweek ) ) ) print 'creating figure...{0}'.format( output_name ) ztf = figure(figsize=(4.4, 6), facecolor='w') ztf.subplots_adjust(wspace=0.2,hspace=0.2,left=0.05,right=0.95,bottom=0.05,top=0.95) ax = ztf.add_subplot(1,1,1,aspect='equal') ctitle = 'Position of the interface toe on {0}'.format( cdate ) text(0.0,1.01,ctitle,horizontalalignment='left',verticalalignment='bottom',size=7,transform=ax.transAxes) au.polyline_plot( ax, hydrography, '0.25' ) au.point_plot( ax, salinity_struc, marker='o', markersize=3, markeredgecolor='red', markerfacecolor='red' ) au.point_plot( ax, df_struc, marker='s', markersize=3, markeredgecolor='blue', markerfacecolor='white' ) au.point_plot( ax, pws, marker='o', markersize=1, markeredgecolor='black', markerfacecolor='black' ) ch1 = ax.contour(xcell,ycell,sw1,levels=swlevels,colors='b',linewidths=0.5) ch2 = ax.contour(xcell,ycell,sw2,levels=swlevels,colors='g',linewidths=0.5) ch3 = ax.contour(xcell,ycell,sw3,levels=swlevels,colors='r',linewidths=0.5) #--plot limits ax.set_xlim(xmin,xmax), ax.set_ylim(ymin,ymax) #--save the figure ztf.savefig(output_name,dpi=300) #--clear memory mpl.pyplot.close('all') gc.collect()