Ashwin,

I have found that the scikit image routine find_contours is easier to work with than extracting the data from the ContourSet object as in the cited stackoverflow example. If you do something like

from skimage.measure import find_contours

cs = find_contours(array, values)

(where values are the levels you want for your contours and array is the grid of values) then you get back a list of contour lines. For each contour you have a Nx2 array of effective indices into the array. You can convert to your lat-long grid by multiplying by the appropriate scales. skimage also has a nice routine called grid_points_in_poly which will return a boolean array that is True for all points of the input array that are inside the polygon to which you can use one of the contours as an input.

Regards,

Jon

_______________________________________________

SciPy-User mailing list

[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user