コード例 #1
0
print 'Head                 [{0:10.3f},{1:10.3f}]'.format(minh,maxh)
print 'DTW                  [{0:10.3f},{1:10.3f}]'.format(np.min(dtw),np.max(dtw))
on_date = start_date
cdate = datetime.strftime( on_date, '%m/%d/%Y' )
#-Make figures
#--head figure
output_name = os.path.join( '..', 'Figures', 'Heads', 'Head_{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 = 'Groundwater head (m) on {0}'.format( cdate )
text(0.0,1.01,ctitle,horizontalalignment='left',verticalalignment='bottom',size=7,transform=ax.transAxes)
#hp = ax.pcolor(Xedge,Yedge,hd,vmin=-1.5,vmax=2,cmap='jet_r',alpha=1.0,edgecolors='None')
hp = ax.imshow(np.flipud(hd),vmin=-1.5,vmax=2,cmap='jet_r',alpha=1.0,extent=[xmin,xmax,ymin,ymax])
au.polyline_plot( ax, hydrography, '0.25' )
ch = ax.contour(xcell,ycell,hd,levels=hdcontour,colors='k',linewidths=0.5)
ax.clabel(ch,inline=1,fmt='%5.1f',fontsize=6)
#--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()
#--depth to water figure
output_name = os.path.join( '..', 'Figures', 'DTW', 'DTW_{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')
コード例 #2
0
                     top=0.95)
 ax = ztf.add_subplot(1, 1, 1, aspect='equal')
 text(0.0,
      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',
コード例 #3
0
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)
コード例 #4
0
     for irow in xrange(0,nrow):
         for jcol in xrange(0,ncol):
             if offshore[irow,jcol] == 2:
                sw[ilay,irow,jcol] = 1 
 #--make the map 
 #--head plot
 ztf = mpl.pyplot.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 = 'Average water-table'
 if idx > 0:
     ctitle = '{0}: {1}'.format( ctitle, ztext[idx] )
 ax.text(0.0,1.01,ctitle,horizontalalignment='left',verticalalignment='bottom',size=7,transform=ax.transAxes)
 temp = np.ma.masked_where(ib<1,h0_avg)
 hp = ax.imshow(temp,vmin=-1.5,vmax=2,cmap='jet_r',alpha=1.0,extent=[xmin,xmax,ymin,ymax])
 au.polyline_plot( ax, hydrography, 'blue' )
 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,temp,levels=hdcontour,colors='k',linewidths=0.5)
 ax.clabel(ch,inline=1,fmt='%5.1f',fontsize=6)
 #--colorbar
 cax=mpl.pyplot.axes([0.75,0.065,0.025,0.20])
 mpl.pyplot.colorbar(hp,cax=cax,orientation='vertical')                                       
 cax.set_title('meters',size=8) 
 #--plot limits
 ax.set_xlim(xmin,xmax), ax.set_ylim(ymin,ymax)
 #--save the figure
 if idx == 0:
     output_name = os.path.join( OutputDir, 'Average_Head.png' )
 else: