Hi Aman,
thanks for your code. I am testing it right now, but i think this might
what i need.
Not sure if you know this: what is the difference between:
1) scipy.interpolate.griddata
2) matplotlib.mlab.griddata
For 2) you have specify the interpolation method and i think the calling
convention is different. Is one a wrapper for the other?
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
------------------------------------------------------------------------------
Malware Security Report: Protecting Your Business, Customers, and the
Bottom Line. Protect your business and customers by understanding the
threat from malware and how it can impact your online business.
http://www.accelacomm.com/jaw/sfnl/114/51427462/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users