From: Eli B. <eb...@gm...> - 2009-01-28 01:16:11
|
Many thanks to Jeff and to Patric ! I will try to work along the line suggested by Jeff. Patric, please send me your code. I hope to learn from it. Thanks again, Eli On Tue, Jan 27, 2009 at 7:09 PM, Patrick Marsh <pat...@gm...>wrote: > On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker <js...@fa...> wrote: > > Eli Brosh wrote: > >> Hello, > >> I am trying to extract the coordinates of contour lines. > >> I tried the following: > >> > >> cs = *contour*(Z) > >> for lev, col in zip(cs.levels, cs.collections): > >> s = col._segments > >> > >> that I found in a previous post (title "contouring", by Jose > >> Gómez-Dans-2 <http://www.nabble.com/user/UserProfile.jtp?user=30071> > >> Nov 30, 2007; 07:47am ) . > >> > >> I hoped that s will be a list of numpy arrays, each containing the > >> (x,y) vertices > >> defining a contour line at level lev. > >> However, I got an error message: > >> AttributeError: 'LineCollection' object has no attribute '_segments' > >> > >> > >> How is it possible to get coordinates of the contours, similar to the > >> MATLAB command > >> [C,H] = *CONTOUR*(...) > >> where the result in C is the coordinates of the contours. > >> > >> A similar question appeared in a post "contour data" (by Albert Swart > >> <http://www.nabble.com/user/UserProfile.jtp?user=382945> May 17, 2006; > >> 09:42am) but I could not understand the answer. > >> Is it possible to get more specific directions with a simple example ? > >> > >> > >> Thanks > >> Eli > > Eli: Calling get_paths() on each line collection in CS.collections will > > return a list of Path objects. From the Path objects, you can get a Nx2 > > array of vertices from the "vertices" attribute. There are no examples > > that I know of, but if you get it to do what you want to do, it would be > > great if you could contribute an example. As you noted, this question > > has come up several times before. > > > > -Jeff > > > > -- > > Jeffrey S. Whitaker Phone : (303)497-6313 > > Meteorologist FAX : (303)497-6449 > > NOAA/OAR/PSD R/PSD1 Email : Jef...@no... > > 325 Broadway Office : Skaggs Research Cntr 1D-113 > > Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg > > > > > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by: > > SourcForge Community > > SourceForge wants to tell your story. > > http://p.sf.net/sfu/sf-spreadtheword > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > I'm not sure if this is entirely what you (Eli) are looking for, but I > have code that will contour model data on a map and then extract the > lat,lon pairs of all the vertices. If this is what you are looking > for, I'm happy to share what I've done. > > -Patrick > > -- > Patrick Marsh > Graduate Research Assistant > School of Meteorology > University of Oklahoma > http://www.patricktmarsh.com > |