/[escript]/branches/doubleplusgood/doc/examples/inversion/plot_ermapper.py
ViewVC logotype

Diff of /branches/doubleplusgood/doc/examples/inversion/plot_ermapper.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4344 by jfenwick, Wed Feb 27 03:42:40 2013 UTC revision 4345 by jfenwick, Fri Mar 29 07:09:41 2013 UTC
# Line 14  Line 14 
14    
15  """This example show how to display ER Mapper raster data with matplotlib"""  """This example show how to display ER Mapper raster data with matplotlib"""
16    
17    import matplotlib
18    # The following line is here to allow automated testing. Remove or comment if
19    # you would like to display the final plot in a window instead.
20    matplotlib.use('agg')
21  from matplotlib import pyplot as plt  from matplotlib import pyplot as plt
22  import numpy as np  import numpy as np
23  import sys  import sys
 from scipy.io import netcdf_file  
24    
25  # input filename  # input filename
26  if len(sys.argv)>1:  if len(sys.argv)>1:
27      FILENAME=sys.argv[1]      FILENAME=sys.argv[1]
28  else:  else:
29      FILENAME='data/QLDWest_grav.ers'      FILENAME='data/QLDWestGravity.ers'
30    
31    
32  if FILENAME[-4:]=='.ers': FILENAME=FILENAME[:-4]  if FILENAME[-4:]=='.ers': FILENAME=FILENAME[:-4]
# Line 101  x,y=np.meshgrid(longitude, latitude) Line 104  x,y=np.meshgrid(longitude, latitude)
104  plt.figure(figsize=(6*(spacingX*NX/(spacingY*NY))+1, 6), dpi=100)  plt.figure(figsize=(6*(spacingX*NX/(spacingY*NY))+1, 6), dpi=100)
105  plt.pcolor(x, y, DATA)  plt.pcolor(x, y, DATA)
106  locs,_=plt.xticks()  locs,_=plt.xticks()
107  plt.xticks(locs, map(lambda x:"%g"%x, locs))  plt.xticks(locs, list(map(lambda x:"%g"%x, locs)))
108  plt.xlabel(labelX)  plt.xlabel(labelX)
109  plt.ylabel(labelY)  plt.ylabel(labelY)
110  plt.axis('tight')  plt.axis('tight')
111  plt.title(FILENAME)  plt.title(FILENAME)
112  plt.colorbar()  plt.colorbar()
113    
114  plt.show()  plt.show()
115    plt.savefig("ermapper_plot.png")
116    

Legend:
Removed from v.4344  
changed lines
  Added in v.4345

  ViewVC Help
Powered by ViewVC 1.1.26