|
From: Chao Y. <cha...@gm...> - 2014-04-14 07:46:33
|
Dear all, I am trying to plot some data (see attached data.txt) on global coverage with 1-degree resolution on the Robinson projection using Basemap. However I get some strange band on the high latitude, and imshow function by matplotlib does not show similar thing. Please refer to the two attached figures. Could anyone give me some tips? thanks!!! Below is a working example: import numy as np import mpl_toolkits.basemap as bmp import matplotlib.pyplot as plt #The example file data.txt could be downloaded from dropbox: https://www.dropbox.com/s/xma4w540qa83sa6/data.txt ############# data=np.genfromtxt('data.txt',usemask=True,missing_values='0.000000000000000000e+00') print np.ma.unique(data) lev = np.arange(0.5,8.6,1) print lev ### here we have to first build the equal-distance grid, this is inspired from here: ### http://matplotlib.1069221.n5.nabble.com/Basemap-plotting-data-on-projection-td40973.html cyl_basemap = bmp.Basemap(projection='cyl', llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180, resolution='l') lon, lat = cyl_basemap.makegrid(360, 180) fig,ax=plt.subplots(1,1) m=bmp.Basemap(projection='robin',lon_0=0,resolution='c',ax=ax) m.drawcoastlines() x, y = m(lon, np.flipud(lat)) m.contourf(x,y,data=data,levels=lev) ############################# Cheers, Chao -- please visit: http://www.globalcarbonatlas.org/ *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************ |