Changeset 21588


Ignore:
Timestamp:
03/06/17 02:07:37 (8 years ago)
Author:
bdef
Message:

CHG:bug fix and adding Hydro BC plotting

Location:
issm/trunk-jpl/src/m/plot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/plot_BC.py

    r21303 r21588  
    88from applyoptions import applyoptions
    99from plot_icefront import plot_icefront
     10from mpl_toolkits.mplot3d import Axes3D
    1011
    11 def plot_BC(md,options,fig,ax):
     12def plot_BC(md,options,fig,axgrid,gridindex):
    1213        '''
    1314        PLOT_BC - plot model boundary conditions
     
    1819                See also: PLOTMODEL
    1920        '''
     21        x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
    2022       
     23        ax=axgrid[gridindex]
     24        fig.delaxes(axgrid.cbar_axes[gridindex])
     25
     26        if not is2d:
     27                ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
     28
    2129        #plot neuman
    2230        plot_icefront(md,options,fig,ax)
    23         x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
     31
    2432        XLims=[np.min(x),np.max(x)]
    2533        YLims=[np.min(y),np.max(y)]
     
    3644                                                         y[np.where(~np.isnan(md.stressbalance.spcvz))],
    3745                                                         marker='o',c='y',s=80,label='vz Dirichlet',linewidth=0)
    38 
     46                ax.scatter(x[np.where(~np.isnan(md.hydrology.spcepl_head))],
     47                                                         y[np.where(~np.isnan(md.hydrology.spcepl_head))],
     48                                                         marker='v',c='r',s=240,label='EPL Head',linewidth=0)
     49                ax.scatter(x[np.where(~np.isnan(md.hydrology.spcsediment_head))],
     50                                                         y[np.where(~np.isnan(md.hydrology.spcsediment_head))],
     51                                                         marker='^',c='b',s=240,label='IDS head',linewidth=0)
     52               
    3953                ax.set_xlim(XLims)
    4054                ax.set_ylim(YLims)
    41         ax.legend()
     55        ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
     56                                                ncol=3, mode="expand", borderaxespad=0.)
    4257        #apply options
    4358        options.addfielddefault('title','Boundary conditions')
    4459        options.addfielddefault('colorbar','off')
    45         applyoptions(md,[],options,fig,ax)
     60        applyoptions(md,[],options,fig,axgrid,gridindex)
    4661       
  • issm/trunk-jpl/src/m/plot/plot_icefront.py

    r21303 r21588  
    1616#process mesh and data
    1717        x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
    18         icefront=np.where(np.logical_and(np.sum(md.mask.ice_levelset[elements],1)<3,np.sum(md.mask.ice_levelset[elements],1)>-3))
     18
     19        #icefront check
     20        icefront=np.where(np.abs(np.sum(md.mask.ice_levelset[elements],1))!=3)
    1921        onlyice=np.where(np.sum(md.mask.ice_levelset[elements],1)==-3)
    2022        noice=np.where(np.sum(md.mask.ice_levelset[elements],1)==3)
    2123
     24        #hydro neumann
     25        hydro_neumann=np.where(md.hydrology.neumannflux!=0)
    2226        #plot mesh
    2327        ax.triplot(x,y,elements)
    2428
    2529        #highlight elements on neumann
    26         colors=np.asarray([0.5 for element in elements[icefront]])
    27        
    28         ax.tripcolor(x,y,elements[icefront],facecolors=colors,alpha=0.5,label='elements on ice front')#,facecolor='b'
     30        if len(icefront[0])>0:
     31                colors=np.asarray([0.5 for element in elements[icefront]])
     32                ax.tripcolor(x,y,elements[icefront],facecolors=colors,alpha=0.5,label='elements on ice front')
     33        if len(hydro_neumann[0])>0:
     34                colors=np.asarray([0.5 for element in elements[hydro_neumann]])
     35                ax.tripcolor(x,y,elements[hydro_neumann],facecolors=colors,alpha=0.5,label='non zero neumann flux for the hydrology')
    2936
    3037        #apply options
    3138        options.addfielddefault('title','Neumann boundary conditions')
    3239        options.addfielddefault('colorbar','off')
    33         applyoptions(md,[],options,fig,ax)
  • issm/trunk-jpl/src/m/plot/plot_mesh.py

    r21475 r21588  
    33except ImportError:
    44        print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
     5
    56import numpy as np
    6 import matplotlib as mpl
    77from processmesh import processmesh
    88from applyoptions import applyoptions
    9 from matplotlib.patches import Polygon
    109from mpl_toolkits.mplot3d.art3d import Line3DCollection
    1110from mpl_toolkits.axes_grid1 import inset_locator
     
    2928        else:
    3029                ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
    31                
    3230               
    3331                AB=elements[:,0:2]
Note: See TracChangeset for help on using the changeset viewer.