Re: help with data points of contour. [message #16915 is a reply to message #16904] |
Tue, 24 August 1999 00:00  |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<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
<p>I now want to determine the x,y data points that form the z=20 contour.
<br>How do I do this. The manual is rather cryptic on this.
<p>thanks-Peter Brooker</blockquote>
The contour positions can be written to a variable using the PATH_INFO
and PATH_XY.
<br>
<p>Something like this...
<p>pro test
<br>
<p>nn=101
<br>x=findgen(nn)-(nn-1.)/2.
<br>y=x
<br>z=fltarr(nn,nn)
<p>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>
<p>contour,z,x,y,levels=[10,20,30,40],Path_XY = Path_XY,Path_Info = Path_Info
<p>; the Path_info contains such as number of verticies and how far down
the list in Path_XY they start
<br>; level 20 is index #1 in this case
<p>help, Path_Info[1], /struct
<p> ;it should apears like this
<br>;IDL> help,path_info[1],/struct
<br>;** Structure CONTOUR_PATH_STRUCTURE, 6 tags, length=16:
<br>; TYPE &n bsp;
BYTE &n bsp; 1
<br>; HIGH_LOW &a mp;nbsp; BYTE &n bsp;
0
<br>; LEVEL & nbsp;
INT &nb sp; &nb sp;
3
<br>; N   ;   ;
LONG &n bsp; &n bsp;
308
<br>; OFFSET & ;nbsp;
LONG &n bsp; &n bsp;
5
<br>; VALUE & nbsp;
FLOAT & nbsp; 40.0000
<p>Offset = Path_Info[1].Offset ; start at index Offset
<br>N = Path_Info[1].N &n bsp; &n bsp;
; there are N verticies
<p> ; to get the XY pairings of the verticies
<p>XY20 = Path_XY[*,Offset:Offset+N-1]
<p>help, XY20
<p>;IDL> help,XY20
<br> ;XY20 & nbsp;
FLOAT = Array[2, 308]
<br>
<p>stop
<br>end
<br>
<pre>--
Ben Tupper
Bigelow Laboratory for Ocean Science
tupper@seadas.bigelow.org
Pemaquid River Company
pemaquidriver@tidewater.net</pre>
</html>
|
|
|