Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 24th, 2012  |  syntax: Python  |  size: 1.06 KB  |  views: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         x = np.array(lats)
  2.         y = np.array(lons)
  3.         z = np.array(data)
  4.         xi = np.linspace(lat_min, lat_max, ngrid)
  5.         yi = np.linspace(lon_min, lon_max, ngrid)
  6.         zi = griddata(x, y, z, xi, yi)
  7.        
  8.         m = Basemap(
  9.             projection = 'merc',
  10.             llcrnrlat=lat_min, urcrnrlat=lat_max,
  11.             llcrnrlon=lon_min, urcrnrlon=lon_max,
  12.             rsphere=6371200., resolution='l', area_thresh=10000
  13.             lat_ts = 20, resolution = 'c'
  14.         )
  15.  
  16.         # draw parallels
  17.         delat = 10.0
  18.         parallels = np.arange(0., 90, delat)
  19.         m.drawparallels(parallels, labels=[1,0,0,0], fontsize=10)
  20.  
  21.         # draw meridians
  22.         delon = 10.
  23.         meridians = np.arange(180.,360.,delon)
  24.         m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10)
  25.        
  26.         # draw map features
  27.         m.drawcoastlines(linewidth = 0.50)
  28.         m.drawcountries(linewidth = 0.50)
  29.         m.drawstates(linewidth = 0.25)
  30.        
  31.         cs = m.contour(xi, yi, zi, 20, linewidths = 1)
  32.         plt.show()