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

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

BUG:fixing segmentation fault with masked NaNs

File size: 1.1 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 #plot mesh
25 ax.triplot(x,y,elements)
26
27 #highlight elements on neumann
28 if len(icefront[0])>0:
29 colors=np.asarray([0.5 for element in elements[icefront]])
30 ax.tripcolor(x,y,elements[icefront],facecolors=colors,alpha=0.5,label='elements on ice front')
31
32 #apply options
33 options.addfielddefault('title','Neumann boundary conditions')
34 options.addfielddefault('colorbar','off')
Note: See TracBrowser for help on using the repository browser.