comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Labelling Highs/Lows in contour
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Labelling Highs/Lows in contour [message #12501] Thu, 13 August 1998 00:00 Go to next message
Amit Ghosh is currently offline  Amit Ghosh
Messages: 7
Registered: July 1998
Junior Member
Is there a way to automatically label highs and lows on a contour plot ? For
example place an L or H in a trough or peak respectively.

Amit

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Re: Labelling Highs/Lows in contour [message #12575 is a reply to message #12501] Sat, 15 August 1998 00:00 Go to previous message
Martin Schultz is currently offline  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/
------------------------------------------------------------ -------
Re: Labelling Highs/Lows in contour [message #12576 is a reply to message #12501] Fri, 14 August 1998 00:00 Go to previous message
Amit Ghosh is currently offline  Amit Ghosh
Messages: 7
Registered: July 1998
Junior Member
In article <35D3CD90.E94C3B56@earthling.nospam.net>,
Phillip & Suzanne David <pdavid@earthling.nospam.net> wrote:
> David Fanning wrote:
>>
>> Amit (amit@physics.utoronto.ca) writes:
>>
>>> Is there a way to automatically label highs and lows on a contour plot ?
For
>>> example place an L or H in a trough or peak respectively.
>>
> At a guess, I would write the contour the usual way, then find the max and min
> of the underlying data, calculate coordinates into the plot based on the
> locations of the max and min, and place (in overplot mode -- I don't remember
> the name of the function to do this) an L at the min and an H at the max.
> That's the simplest algorithm I can think of.
>
>> P.S. Does anyone know how to find the slope of
>> a 2D array. :-(
>

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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL Velocity Streamline Procedure ??
Next Topic: Re: executing a .sav file by double clicking it.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 22:03:29 PDT 2025

Total time taken to generate the page: 0.80959 seconds