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 <goyod...@gmail.com> wrote:
> El día 12 de marzo de 2012 23:25, questions anon
> <questions.a...@gmail.com> 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
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users