From: Benjamin R. <ben...@ou...> - 2012-03-14 20:48:54
|
On Tue, Mar 13, 2012 at 4:23 PM, questions anon <que...@gm...>wrote: > also I have tried running it on a different computer and the same error > occurred > > > On Wed, Mar 14, 2012 at 8:22 AM, questions anon <que...@gm...>wrote: > >> thanks for looking into this Goyo. >> The complete code: >> >> >> import numpy as N >> import matplotlib.pyplot as plt >> from numpy import ma as MA >> from mpl_toolkits.basemap import Basemap >> import os >> >> shapefile="E:/GIS_layers/DSE_REGIONS" >> inputfile=r"d:/BoMdata/r19000117.txt" >> outputfolder=r"d:/BoMdata/outputfolder" >> >> f=N.genfromtxt(inputfile, skip_header=6, dtype=float, names=True) >> print f[0:5] >> >> >> map = Basemap(projection='merc',llcrnrlat=-45,urcrnrlat=-9, >> llcrnrlon=111.975,urcrnrlon=156.525,lat_ts=0,resolution='i') >> map.drawcoastlines() >> map.drawstates() >> map.readshapefile(shapefile, 'DSE_REGIONS') >> >> xi=N.linspace(111.975, 156.275, 886) >> yi=N.linspace(-44.525, -9.975, 691) >> x,y=map(*N.meshgrid(xi,yi)) >> plt.title('rainfall') >> CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet) >> l,b,w,h =0.1,0.1,0.8,0.8 >> cax = plt.axes([l+w+0.025, b, 0.025, h]) >> plt.colorbar(CS,cax=cax, drawedges=True) >> plt.savefig((os.path.join(outputfolder, 'rainfall.png'))) >> plt.show() >> plt.close() >> >> >> and the complete error: >> >> >> Traceback (most recent call last): >> File "d:/BoMdata/plotrainfall_v2.py", line 23, in <module> >> >> CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet) >> File "C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py", >> line 3072, in contourf >> np.logical_or(outsidemask,np.logical_or(ma.getmaskarray(data),xymask)) >> AttributeError: logical_or >> >> Any feedback/ideas will be greatly appreciated. >> >> >> Your error is very strange and it just simply should not be happening. On a completely wild guess, could you try replacing "import numpy as N" with "import numpy as np" and replace all instances of "N" with "np"? Ben Root |