source: issm/trunk-jpl/src/m/plot/plot_icefront.py@ 21588

Last change on this file since 21588 was 21588, checked in by bdef, 8 years ago

CHG:bug fix and adding Hydro BC plotting

File size: 1.3 KB
Line 
1try:
2 import pylab as p
3except ImportError:
4 print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
5import numpy as np
6from processmesh import processmesh
7from applyoptions import applyoptions
8
9def plot_icefront(md,options,fig,ax):
10 #PLOT_ICEFRONT - plot segment on neumann BC
11 #
12 # Usage:
13 # plot_icefront(md,options,width,i)
14 #
15 # See also: PLOTMODEL
16#process mesh and data
17 x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
18
19 #icefront check
20 icefront=np.where(np.abs(np.sum(md.mask.ice_levelset[elements],1))!=3)
21 onlyice=np.where(np.sum(md.mask.ice_levelset[elements],1)==-3)
22 noice=np.where(np.sum(md.mask.ice_levelset[elements],1)==3)
23
24 #hydro neumann
25 hydro_neumann=np.where(md.hydrology.neumannflux!=0)
26 #plot mesh
27 ax.triplot(x,y,elements)
28
29 #highlight elements on neumann
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')
36
37 #apply options
38 options.addfielddefault('title','Neumann boundary conditions')
39 options.addfielddefault('colorbar','off')
Note: See TracBrowser for help on using the repository browser.