Re: help with data points of contour. [message #16904] |
Wed, 25 August 1999 00:00  |
Nando Iavarone
Messages: 48 Registered: December 1998
|
Member |
|
|
<HTML>
Peter Brooker wrote:
<BLOCKQUOTE TYPE=CITE>Consider the following simple program.
<P>nn=101
<BR>x=findgen(nn)-(nn-1.)/2.
<BR>y=x
<BR>z=fltarr(nn,nn)
<BR>for i=0,(nn-1) do begin
<BR>for j=0,(nn-1) do begin
<BR> z(i,j)=sqrt(x(i)^2+y(j)^2)
<BR> endfor
<BR> endfor
<BR>contour,z,x,y,levels=[10,20,30,40]
<BR>end</BLOCKQUOTE>
a question.why do you use loop?
<BR> I use the technique:
<P>pro test
<P> nn=101
<P> x = findgen(nn)-(nn-1.)/2.
<BR> y = x
<BR> x = x#replicate(1,nn)
<BR> y = replicate(1,nn)#y
<P> z = sqrt(x^2+y^2)
<BR>
<BR>end
<P>don't you think it is more readeble and maybe, I didn't test it, quicker?
<BR>
<BLOCKQUOTE TYPE=CITE>I now want to determine the x,y data points that
form the z=20 contour.</BLOCKQUOTE>
I think that if you are interested only in discrete value of your coordinate,it
is sufficient to do:
<P>index = where(z eq 20)
<BR>x_index = index mod nn
<BR>y_index = index / nn
<BR>print, x_index, y_index
<P>bye.
<PRE>--
Nando Iavarone
Advanced Computer System - SPACE DIVISION
via Lazzaro Belli, 23
00040 Frascati - RM
Tel: +39-6-944091 (switchboard)
9440968 (direct)
E-mail:
f.iavarone@acsys.it
FrdndVrn@altavista.net</PRE>
</HTML>
|
|
|