Re: Labelling Highs/Lows in contour [message #12575 is a reply to message #12501] |
Sat, 15 August 1998 00:00   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
amit@physics.utoronto.ca wrote:
>
> [..]
> Finding maxes and mins in the data (I guess what David was hinting at by
> asking to find the deriv of a 2D array) and labelling every one of them is
> easy, but that's not the question I asked. I only want to determine if the
> contour surrounds a high or low and label it appropriately. I don't want to
> label extrema between contours or multiple extrema within one contour. Of
> course only simple and elegant solutions are acceptable. :)
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Just a thought: how about retrieving the contour coordinates (something
like the PATHXY keyword), checking for closed contours (first and last
point identical or very close), and then using the length of the contour
line (number of points) to find the smallest ones which should surround
your highs and lows. You would probably have to play around a little and
also find a way to determine how many highs and lows you have, but this
would be something you could try. Another "trick" once you found the
closed contour lines could be to fill these contours additively
(treating them as image - instead of replacing a group of pixels with a
color value as POLYFILL does, you would have to add 1 to the pixel
value). Then it should be easy enough to find the relative minima and
maxima.
On the other hand: since contour lines are somewhat arbitrary... You
could smooth your data before looking for minima and maxima. In order to
exclude extrema "between contours" (saddle points ?) you would have to
test each extremum in all directions (i.e. are ALL neighbouring points
higher or lower than the point in question). Hence you could look for
extrema say in x direction and then test them for y and the diagonals.
If you have concerns about speed (i.e. a huuuuge data array), you could
first "transform" your data into an "image" array (BYTSCL and CONGRID).
That should be precise enough if you are only looking for spots to label
your plot.
Hope this helps a little and I don't blame myself too much in front of
the experts,
Martin.
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
|
|
|