Polar_contour question [message #94618] |
Tue, 25 July 2017 12:39  |
thtran296
Messages: 8 Registered: June 2017
|
Junior Member |
|
|
Hi all,
So I am tasked with using the "polar_contour" procedure in IDL to plot things.
I am given 2 arrays of data, 1 is the radius, and the other is Angle.
radius = [.....] ---> this is an array of 900 elements, randomly from value of 0 to 2000 km.
Angle = [.....] ----> this is an array of 900 elements too, randomly from value of 0 to 6 rad.
Reading from the IDL help page for the polar_contour procedure, it looks something like this:
polar_contour, z, theta, r.
I know that "z" will be a 2-D array (n x n matrix) , and theta and r are 1-D array each. But I'm having problem with what values actually go into each of these arguments? And where in the argument should my 2 arrays (given above) go?
IDL help page only defines "Z" as "the data values to be contoured." What does that even mean?
Theta and r are defined by IDL as vectors of angles and radius, respectively. But what actually goes into these 2 vectors?
Could somebody please help clarify things for me?
Thank you so much.
|
|
|
Re: Polar_contour question [message #94622 is a reply to message #94618] |
Wed, 26 July 2017 05:34  |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
On 07/25/2017 09:39 PM, thtran296@gmail.com wrote:
> So I am tasked with using the "polar_contour" procedure in IDL to plot things.
> I am given 2 arrays of data, 1 is the radius, and the other is Angle.
>
> radius = [.....] ---> this is an array of 900 elements, randomly from value of 0 to 2000 km.
> Angle = [.....] ----> this is an array of 900 elements too, randomly from value of 0 to 6 rad.
>
> Reading from the IDL help page for the polar_contour procedure, it looks something like this:
>
> polar_contour, z, theta, r.
>
> I know that "z" will be a 2-D array (n x n matrix) , and theta and r are 1-D array each. But I'm having problem with what values actually go into each of these arguments? And where in the argument should my 2 arrays (given above) go?
>
> IDL help page only defines "Z" as "the data values to be contoured." What does that even mean?
> Theta and r are defined by IDL as vectors of angles and radius, respectively. But what actually goes into these 2 vectors?
>
> Could somebody please help clarify things for me?
Do you want to contour the density of the points?
Then try something like this:
binsize=10
radius= randomu(seed,900)*2000
angle = randomu(seed,900)*6
h=hist_2d( radius*sin(angle),radius*cos(angle),min1=-2000,max1=2000, $
min2=-2000,max2=2000,bin1=binsize,bin2=binsize )
binsize2=2*!pi/200
h2=hist_2d( radius, angle, min1=0,max1=2000,bin1=binsize, $
min2=0,max2=2*!pi,bin2=binsize2)
contour, h, [-2000:2000:binsize], [-2000:2000:binsize]
contour, smooth(float(h),10,/edge_truncate), $
[-2000:2000:binsize], [-2000:2000:binsize]
polar_contour, h2, [0:2000:binsize], [0:2*!pi:binsize2]
polar_contour, smooth(float(h2),10,/edge_truncate), [0:2000:binsize], $
[0:2*!pi:binsize2]
However, the smoothing in polar coordinates might have to be done
differently, but I don't know how without looking into it in more detail.
As to what "the data values to be contoured" means:
Imagine that all data triples (radius,angle,z) in cylindrical
coordinates are part of a surface.
The contours are then the lines on this surface which have the same
altitude (z value).
I hope this helps, if not, try to describe better what you want.
Good luck, Markus
|
|
|