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

Home » Public Forums » archive » Q: contour levels from IDL
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
Q: contour levels from IDL [message #19298] Fri, 10 March 2000 00:00 Go to next message
Mirko Vukovic is currently offline  Mirko Vukovic
Messages: 124
Registered: January 1996
Senior Member
Help!

How can I get back from IDL the contour levels that it plotted up?

ztick_get does not cut it, and I do not feel like using path_info
(I would need to invoke contour twice for that).

The procedure should be able to handle IDL default choice,
usage of NLEVELS or LEVELS.

TIA,

Mirko


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: Q: contour levels from IDL [message #19458 is a reply to message #19298] Thu, 23 March 2000 00:00 Go to previous message
Mirko Vukovic is currently offline  Mirko Vukovic
Messages: 124
Registered: January 1996
Senior Member
In article <MPG.1342b0d5f404e4f9989aa4@news.frii.com>,
davidf@dfanning.com (David Fanning) wrote:
> H C Pumphrey (hcp@newsread.ed.ac.uk) writes:
>
>> It's the price you pay for getting to pick the range _and_ having
nice round
>> numbers for the contour values.
>
> And I thought I was pretty anal when it comes to how
> things look. But I have to admit I have more trouble
> with "NLEVELS=whatever" than I do with numbers that end in
> a 1. :-)
>
> Cheers,
>
> David
>
> P.S. And really, "NLEVELS=whatever" worked for me for a lot
> of years. It was only when I was trying to fill the contours
> with specific colors that I noticed the whole top part of
> my color table was missing. :-)
>
> --
There seem to be two purposes of contours. One is to get the user a
feel for for the shape of the surface, and the other is to obtain rather
precise info on the coordinates of a specific surface height.

In that light, nlevels serves the first purpose and levels serves the
second. Fourtuitously each keyword is suitable for one purpose only and
not the other.

Does this make sense? My seratonin levels are kind of low this morning.


BTW, thanks a bunch for the submitted code snippets.

Mirko


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: Q: contour levels from IDL [message #19480 is a reply to message #19298] Wed, 22 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
H C Pumphrey (hcp@newsread.ed.ac.uk) writes:

> It's the price you pay for getting to pick the range _and_ having nice round
> numbers for the contour values.

And I thought I was pretty anal when it comes to how
things look. But I have to admit I have more trouble
with "NLEVELS=whatever" than I do with numbers that end in
a 1. :-)

Cheers,

David

P.S. And really, "NLEVELS=whatever" worked for me for a lot
of years. It was only when I was trying to fill the contours
with specific colors that I noticed the whole top part of
my color table was missing. :-)

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Q: contour levels from IDL [message #19482 is a reply to message #19298] Wed, 22 March 2000 00:00 Go to previous message
hcp is currently offline  hcp
Messages: 41
Registered: August 1995
Member
In article <MPG.134289ae9da4a3f0989a9e@news.frii.com>, davidf@dfanning.com (David Fanning) writes:
|> H C Pumphrey (hcp@newsread.ed.ac.uk) writes:
|> > [snip] you actually get between ndesired and 2*ndesired
|> > ; contours.
|>
|> I fail to see how this is much of an improvement over
|> IDL's:
|> ncontours = nlevels + (more or less)
|> But certainly not TWO times more! :-)

It's the price you pay for getting to pick the range _and_ having nice round
numbers for the contour values.

(I think I was answering a point that was brought up halfway along the thread
not the original point at all)

Hugh


--

============================================================ ==============
Hugh C. Pumphrey | Telephone 0131-650-6026
Department of Meteorology | FAX 0131-650-5780
The University of Edinburgh | Replace 0131 with +44-131 if outside U.K.
EDINBURGH EH9 3JZ, Scotland | Email hcp@met.ed.ac.uk
OBDisclaimer: The views expressed herein are mine, not those of UofE.
============================================================ ==============
Re: Q: contour levels from IDL [message #19486 is a reply to message #19298] Wed, 22 March 2000 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Mirko Vukovic wrote:
>

> My problem is how to choose intelligent levels. The only way I could
> think of is to plot (2dplot) the z component of the data in a temp
> (ram?) window, and observe the z ticks used by IDL, and use those as
> contour levels.

For logarithmic contour intervals you can try my loglevels routine
at http://www.mpimet.mpg.de/~schultz.martin/idl/index.html

Cheers,
Martin

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: Q: contour levels from IDL [message #19493 is a reply to message #19298] Wed, 22 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
H C Pumphrey (hcp@newsread.ed.ac.uk) writes:

> ; This function returns a set of contours suitable for the range of
> ; values beween max and min. on input ndesired is the number of contours
> ; you want; you actually get between ndesired and 2*ndesired
> ; contours.

I fail to see how this is much of an improvement over
IDL's:

ncontours = nlevels + (more or less)

But certainly not TWO times more! :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Q: contour levels from IDL [message #19494 is a reply to message #19298] Wed, 22 March 2000 00:00 Go to previous message
hcp is currently offline  hcp
Messages: 41
Registered: August 1995
Member
In article <8b5pfs$m7e$1@nnrp1.deja.com>, Mirko Vukovic <mvukovic@taz.telusa.com> writes:

|> My problem is how to choose intelligent levels. The only way I could
|> think of is to plot (2dplot) the z component of the data in a temp
|> (ram?) window, and observe the z ticks used by IDL, and use those as
|> contour levels.

Faced with this, I wrote my own contour chooser which I enclose below.
You give it a max, min and a number of contours and you get back an array
with values whose last digits are like 1,2,3,4 or 2,4,6,8 or
5,10,15,20,25. I like it. YMMV. Sorry about the commented-out
debugging statements.


Enjoy

Hugh


function conpick,minval,maxval,ndesired
; This function returns a set of contours suitable for the range of
; values beween max and min. on input ndesired is the number of contours
; you want; you actually get between ndesired and 2*ndesired
; contours.


;*** Work out a nice spacing for the contours ***

if maxval lt minval then begin
tmp=maxval
maxval=minval
minval=tmp
endif
range=double(maxval)-double(minval)
;print,'range=',range
initspace=range / (ndesired-1)
;print,'initspace=',initspace
reduspace=alog10(initspace)
;print,'reduspace=',reduspace
pwroften=long(reduspace)
if reduspace lt 0.0 then pwroften=pwroften-1
;print,'pwroften=',pwroften
reduspace=reduspace-pwroften
;print,'reduspace=',reduspace
reduspace=10.^reduspace
;print,'reduspace=',reduspace,' Choosing spacing'

if(reduspace ge 5.0) then spacing=5.0 $
;else if(reduspace ge 2.5) then spacing=2.5$
else if(reduspace ge 2.0) then spacing=2.0$

else spacing=1.0
;print,'spacing=',spacing
spacing=spacing*10.^pwroften
;print,'spacing=',spacing

if( (not finite(spacing)) or (not finite(reduspace))) then begin
print,'Error in routine conpick: failed to pick suitable contours'
return,findgen(ndesired)
endif

; *** Work out a minimum value that fits in with the spacing ***
gak=(abs(minval)/(10.0^(pwroften+1)))
igak=long(gak)
if gak lt 0.0 then igak=igak-1
newminval=(10.0^(pwroften+1))* igak
;print,'newminval=',newminval

while(newminval lt abs(minval)) do newminval=newminval+spacing
;print,'newminval=',newminval

if(minval lt 0.0) then newminval=-newminval else newminval=newminval-spacing
;print,'newminval=',newminval,' Making contours'

upper=newminval
ncontours=0
while ( upper lt maxval ) do begin
upper=newminval+ncontours*spacing
ncontours=ncontours+1
endwhile
;print,' made',ncontours,' Contours'
clevs=findgen(ncontours)*spacing + newminval

return,clevs

end




--

============================================================ ==============
Hugh C. Pumphrey | Telephone 0131-650-6026
Department of Meteorology | FAX 0131-650-5780
The University of Edinburgh | Replace 0131 with +44-131 if outside U.K.
EDINBURGH EH9 3JZ, Scotland | Email hcp@met.ed.ac.uk
OBDisclaimer: The views expressed herein are mine, not those of UofE.
============================================================ ==============
Re: Q: contour levels from IDL [message #19522 is a reply to message #19298] Mon, 20 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Mirko Vukovic (mvukovic@taz.telusa.com) writes:

> ??? I remember a note that nelvels does note guarantee the number of
> levels, but not much else. Any other discussions you can refer me to?
>
> My problem is how to choose intelligent levels. The only way I could
> think of is to plot (2dplot) the z component of the data in a temp
> (ram?) window, and observe the z ticks used by IDL, and use those as
> contour levels.

Here is how I do it. I typically pick equally spaced
contour intervals (I.e., what I *thought* IDL was
suppose to be doing. :-)

http://www.dfanning.com/tips/nlevels.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Q: contour levels from IDL [message #19525 is a reply to message #19298] Mon, 20 March 2000 00:00 Go to previous message
Mirko Vukovic is currently offline  Mirko Vukovic
Messages: 124
Registered: January 1996
Senior Member
In article <MPG.13333170892ef001989a8a@news.frii.com>,
davidf@dfanning.com (David Fanning) wrote:
> Mirko Vukovic (mvukovic@taz.telusa.com) writes:
>
>> How can I get back from IDL the contour levels that it plotted up?
>>
>> ztick_get does not cut it, and I do not feel like using path_info
>> (I would need to invoke contour twice for that).
>>
>> The procedure should be able to handle IDL default choice,
>> usage of NLEVELS or LEVELS.
>
> If you have been following my advice, Mirko, you would
> NEVER be letting IDL choose its own contour levels. Thus,
> you would know ipso facto which levels you had. :-)
>
> In the absence of following good advice, I think
> there is nothing to do *but* call the contour command
> twice. :-(
>
> Cheers,
>
> David
>
??? I remember a note that nelvels does note guarantee the number of
levels, but not much else. Any other discussions you can refer me to?

My problem is how to choose intelligent levels. The only way I could
think of is to plot (2dplot) the z component of the data in a temp
(ram?) window, and observe the z ticks used by IDL, and use those as
contour levels.

As a side note, I now use path info, but that has problems, because you
may get several paths at the same contour level.

Mirko



Sent via Deja.com http://www.deja.com/
Before you buy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: CALCULATION OF AREA ON A SPHERE
Next Topic: 3D envelope surface around data points?

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

Current Time: Wed Oct 08 15:09:51 PDT 2025

Total time taken to generate the page: 0.00831 seconds