Hi,
sorry that it has taken me so long to reply. Anyway, i could be wrong,
but i don't think that the code:
    xi = np.linspace(llcrnlon,urcrnlon,1000)
    yi = np.linspace(llcrnlat,urcrnlat,1000)

will produce a grid which gives the lat/lon coordinates with 1km
spacing. The reason being is that the distance between 2 lons (say
-117.731659 and -91.303642) is different depending on where you are in
terms of the latitude (i.e. the extreme examples are of course the north
pole vs the equator). So the above gives a regular grid in terms of
degrees but not in terms of distance.
Anyway, but the example was still helpful in terms of getting me started
with the griddata issue. In my experience the mlab.griddate fcn did not
work as well as the scipy.griddata (but that could be a user error as
well ... ). Not sure why though. It might be the size of my source data
and the destination grid. I had to upgrade to the 64-bit python to be
able to access enough memory.

thanks
matt



On 9/6/2011 12:36 PM, Aman Thakral wrote:
> Hi Matt,
>
> Something like this?:
>
> def create_map(ax, llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat):
>     m =
> Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=(urcrnrlon+llcrnrlon)/2,lat_0=(urcrnrlat+llcrnrlat)/2)
>     m.drawcoastlines()
>     m.drawmapboundary()
>     m.drawstates(linewidth=3)
>     m.fillcontinents(color='lightgrey',lake_color='white')
>     m.drawcountries(linewidth=3)
>     return m
>
>
> def plotMapData(ax,data):
>
>     lats = []
>     lons = []
>     val = []
>   
>     for k,v in data.iteritems():
>         lats.append(float(k[0]))
>         lons.append(float(k[1]))
>         val.append(float(v))
>       
>     value = np.array(val)
>     lat = np.array(lats)
>     lon = np.array(lons)
>            
>     llcrnlon = lon.min()-0.5
>     llcrnlat = lat.min()-0.5
>     urcrnlon = lon.max()+0.5
>     urcrnlat = lat.max()+0.5
>
>     xi = np.linspace(llcrnlon,urcrnlon,1000)
>     yi = np.linspace(llcrnlat,urcrnlat,1000)
>     zi = griddata(lon,lat,value,xi,yi)
>
>     cmap = cm.jet
>     m = create_map(ax,llcrnlon,llcrnlat,urcrnlon,urcrnlat)
>     cs = ax.contour(xi,yi,zi,15,linewidth=0.5,cmap=cmap,alpha=0.5)   
>     ax.contourf(xi,yi,zi,15,cmap=cmap,zorder=1000,alpha=0.5)
>
>     colorscale = cm.ScalarMappable()
>     colorscale.set_array(value)
>     colorscale.set_cmap(cmap)
>
>     colors = colorscale.to_rgba(value)
>     ax.scatter(lon,lat,c=colors,zorder=1000,cmap=cmap,s=10)
>     colorbar(colorscale, shrink=0.50, ax=ax,extend='both')
>    
>
> On Tue, Sep 6, 2011 at 1:28 PM, Matt Funk <matze...@gmail.com
> <mailto:matze...@gmail.com>> wrote:
>
>     Hi,
>     i want to interpolate irregular spaced satellite data onto a regular
>     spaced grid. The regular spaced grid should have cell sizes of
>     1km^2. Is
>     it possible to use basemap to create such a grid. It looked like it
>     includes some facilities like that, but i am not sure if they are
>     meant
>     to be used by end user or more like internal fcns (the makegrid
>     fcn for
>     example).
>
>     Any advice would be appreciated.
>
>     thanks
>     matt
>
>     
> ------------------------------------------------------------------------------
>     Special Offer -- Download ArcSight Logger for FREE!
>     Finally, a world-class log management solution at an even better
>     price-free! And you'll get a free "Love Thy Logs" t-shirt when you
>     download Logger. Secure your free ArcSight Logger TODAY!
>     http://p.sf.net/sfu/arcsisghtdev2dev
>     _______________________________________________
>     Matplotlib-users mailing list
>     Matplotlib-users@lists.sourceforge.net
>     <mailto:Matplotlib-users@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>


-- 
Matt Funk
Research Associate
Plant and Environmental Scienc. Dept.
New Mexico State University

------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to