[Matplotlib-users] Obtaining the contour data in terms of latitude and longitude

Ryan May rmay31 at gmail.com
Wed Oct 18 17:38:42 EDT 2017


For this problem, though, I don't think contouring is what you want. I
think you'd be better off looking for some spatial consistency in the
gradient field directly rather than going through contours.

Ryan

On Wed, Oct 18, 2017 at 2:59 PM, ashwin .D <winash12 at gmail.com> wrote:

> Hello,
>          I have data on a 2d lat lon grid(equal grid spacing) in terms of
> laitude and longitude and heights as enclosed in the image. I need the
> coordinates(in terms of latitude and longitude) of the contours( as shown
> in red in the image). From this answer - https://stackoverflow.com/
> questions/18304722/python-find-contour-lines-from-
> matplotlib-pyplot-contour/ will this give me what I am looking for or is
> there a scaling required to latitude and longitude that I need to include?
>
> Best regards,
> Ashwin.
>
> import numpy as np
> def get_contour_verts(cn):
>     contours = []
>     # for each contour line
>     for cc in cn.collections:
>         paths = []
>         # for each separate section of the contour line
>         for pp in cc.get_paths():
>             xy = []
>             # for each segment of that section
>             for vv in pp.iter_segments():
>                 xy.append(vv[0])
>             paths.append(np.vstack(xy))
>         contours.append(paths)
>
>     return contours
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
>


-- 
Ryan May
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20171018/f0ff4e32/attachment.html>


More information about the Matplotlib-users mailing list