Hi all,
I am still having a problem with the same code. I am not sure if maybe the
problem is how I read the data in as numpy.genfromtxt
Is there a step I need to take to convert the data to numpy array to then
read into matplotlib?
Thanks
On Fri, Mar 2, 2012 at 11:49 AM, questions anon <questions.a...@gmail.com>wrote:
> python, numpy through enthought -
> Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul 3 2011, 15:13:59) [MSC
> v.1500 32 bit (Intel)] on win32
> imports at the top of the script:
>
> import numpy as N
> import matplotlib.pyplot as plt
> from numpy import ma as MA
> from mpl_toolkits.basemap import Basemap
> import os
>
>
>
> On Thu, Mar 1, 2012 at 4:42 PM, Benjamin Root <ben.r...@ou.edu> wrote:
>
>>
>>
>> On Wednesday, February 29, 2012, questions anon wrote:
>>
>>> I have had some progress reading in the data but am unsure how to create
>>> lats and lons from the info I have (see above).
>>> the error I am receiving is:
>>>
>>> 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
>>>
>>>
>>> from the below code:
>>>
>>>
>>> onefile=r"E:/test_in/r19000117.txt"
>>>
>>> f=N.genfromtxt(onefile, skip_header=6, dtype=float, names=True)
>>> print f
>>>
>>>
>>> map = Basemap(projection='merc',llcrnrlat=-45,urcrnrlat=-9,
>>>
>>> llcrnrlon=111.975,urcrnrlon=156.525,lat_ts=0,resolution='i')
>>> map.drawcoastlines()
>>> map.drawstates()
>>> 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()
>>>
>>>
>>>
>> How did you install numpy? Which version are you using? What are your
>> imports at the top of this script?
>>
>> Ben Root
>>
>
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users