From: questions a. <que...@gm...> - 2012-03-13 21:23:33
|
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. > > > > > On Wed, Mar 14, 2012 at 4:59 AM, Goyo <goy...@gm...> wrote: > >> El día 12 de marzo de 2012 23:25, questions anon >> <que...@gm...> escribió: >> [...] >> > >> > Is this how the data should look when it has been imported from an >> ascii to >> > a numpy array? >> >> I can't see anything obiously wrong in your code or your data --I did >> not dive too deep into it though. What is weird is the traceback: >> >> Traceback (most recent call last): >> File "d:\plotrainfall.py", line 40, 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 >> >> Is that the complete traceback? >> >> Goyo >> > > |