Orion Poplawski wrote:
> Jeff Whitaker wrote:
>> Orion Poplawski wrote:
>>> I've got a 2-D array of values that I'd like to plot onto a map with 
>>> Basemap.  The latitude and longitudes for each point are stored in 
>>> their own 2-D array that matches that of the values.  Can some one 
>>> help with how to do this?  Looks like basemap requires a square and 
>>> uniform set of data to plot?
>>>
>> Orion:  There's an example of this in the examples directory called 
>> 'ccsm_popgrid.py'.  Have a look at that, and if you have questions 
>> let us know.
>>
>
>
> Actually, it looks like I may have been making things harder than I 
> thought they would be.  Is there any reason to believe that this isn't 
> doing what it seems like it should?  ccsm_popgrid.py seems much more 
> complicated, and I'm don't really understand it yet.
>
> tpxyzo has data for 12 different altitudes, and I'm selecting one.  It 
> appears the x,y=m(lon,lat) is unneeded for cylindrical projections, 
> but I've left it in here as a general case.
>
> -- 
> from matplotlib.toolkits.basemap import Basemap
> from pylab import *
>
> lat=load('lat.dat').reshape(270,90)
> lon=load('lon.dat').reshape(270,90)
> tpxyzo=load('tpxyzo.dat').reshape(12,270,90)
>
> m=Basemap(llcrnrlon=-80,llcrnrlat=-75,urcrnrlon=-40,urcrnrlat=-42,projection='cyl',resolution='l')
>  
>
> m.drawcoastlines()
> x, y = m(lon,lat)
> m.contourf(x,y,tpxyzo[11,:,:],15)
> show()
> -- 
>
> The output is the attached image, which as you can see does not have a 
> rectangular shape.
>
> Thanks!
>

Orion:  If the image were rectangular on a cylindrical projection, then 
you wouldn't need 2d arrays to describe the lats and lons of the grid.  
Are you sure the image should be rectangular?  What kind of a grid is it?

-Jeff

-- 
Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/PSD  R/PSD1        Email  : [EMAIL PROTECTED]
325 Broadway                Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to