Contoured basemap

Hi
    I have a set of records with known lat long. I want to show the concentration of the records with a contour diagram on a world map in any projection. It cannot spill over to the oceans. I know I have to use basemap. Is there a quick recipe somewhere I can follow to give me a desired output. I have gone through earlier posts on this board but cannot find the right one. Any pointers would be very helpful. Many thanks.
Best
Mitra

Mitra: The basic procedure is this:

1) load you data into 2d numpy arrays (lats, lons, data). lats and lons must be in degrees (not radians).
2) create a Basemap instance (called "map") for the desired projection.
3) calculate the map projection coordinates of your grid with x,y = map(lons,lats)
4) contour your data with the contourf method (map.contourf).
5) draw coastlines with the coastlines method.
6) draw lat/lon lines with the drawparallels and drawmeridians methods.

There are many examples of this in the basemap examples directory.

-Jeff

···

On 1/20/11 2:31 PM, R. Mitra wrote:

Hi
     I have a set of records with known lat long. I want to show the
concentration of the records with a contour diagram on a world map in
any projection. It cannot spill over to the oceans. I know I have to
use basemap. Is there a quick recipe somewhere I can follow to give
me a desired output. I have gone through earlier posts on this board
but cannot find the right one. Any pointers would be very helpful.
Many thanks.
Best
Mitra

In order to contour, you will need some sort z-value to contour. This
means you need to bin your data. You could use numpy's hist2d, or (I
prefer) matplotlib's hexbin().

I hope that helps!
Ben Root

···

On Thursday, January 20, 2011, Jeff Whitaker <jswhit@...146...> wrote:

On 1/20/11 2:31 PM, R. Mitra wrote:

Hi
I have a set of records with known lat long. I want to show the
concentration of the records with a contour diagram on a world map in
any projection. It cannot spill over to the oceans. I know I have to
use basemap. Is there a quick recipe somewhere I can follow to give
me a desired output. I have gone through earlier posts on this board
but cannot find the right one. Any pointers would be very helpful.
Many thanks.
Best
Mitra

Mitra: The basic procedure is this:

1) load you data into 2d numpy arrays (lats, lons, data). lats and lons
must be in degrees (not radians).
2) create a Basemap instance (called "map") for the desired projection.
3) calculate the map projection coordinates of your grid with x,y =
map(lons,lats)
4) contour your data with the contourf method (map.contourf).
5) draw coastlines with the coastlines method.
6) draw lat/lon lines with the drawparallels and drawmeridians methods.

There are many examples of this in the basemap examples directory.

-Jeff

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users