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

Home » Public Forums » archive » Problem with Polar_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
Problem with Polar_contour [message #62083] Mon, 25 August 2008 12:46 Go to next message
tarequeaziz is currently offline  tarequeaziz
Messages: 20
Registered: November 2007
Junior Member
Dear IDL GODS,

I am back with another problem.

I am having troubles regarding polar_contour. The problem is as
follows. I got the following code from one of my buddy where he uses
polar_contour procedure to plot polar data.


" tit='cf_100_ave_POLAR.DAT'


fileout='cf_100_polar.eps'


;---------------
device, retain=0 <-------------------- THIS IS ONE OF
THE PLACES WHERE I GET STUCK !!!!
device, decomposed=0
device, true_color=2048 <------------------- THIS IS ANOTHER
POINT
loadct,1
;---------------


!p.multi=[0,1,1]


;---------------
Ntime=1
Ntime1=Ntime-1l
Nr=0l
Nthe=0l
openr,1,'E_NrNp.dat'
readf,1,Nr
readf,1,Nthe
close,1
;---------------


Nrighe=Ntime*Nr*Nthe
Nslide1=Nr*Nthe
Nslide=Nr*Nthe-1
NDT=1l
Tstart=0l
TIMEEPS=Ntime1
nn=0l
;


openr,1,'POL.data'
polaro=dblarr(2,Nslide1)
readf,1,polaro
close,1

;

nlev=128
lab=findgen(nlev)+1


wrk=dblarr(2,Nslide1)
wrk(0,*)=polaro(0,0:Nslide)
wrk(1,*)=polaro(1,0:Nslide)
r=reform(wrk(0,*),Nthe,Nr)
t=reform(wrk(1,*),Nthe,Nr)



openr,2,tit,/f77_unformatted
data1=dblarr(Nslide1)
data0=dblarr(Nr,Nthe)





nframe=0l
for j=0l,Ntime1 do begin
readu,2,data0
endfor

RMIN=MIN(data0)
RMAX=MAX(data0)
;RMIN=ABS(RMAX - RMIN)/


nn=0l
for ir=0l,Nr-1 do begin
for ithe=0l,Nthe-1 do begin
data1(nn)=data0(ir,ithe)
nn=nn+1l
endfor
endfor

ttt=j*1.0

tit0=string(ttt,format='(" - F - Time = ",F10.2)')

z1=reform(data1,Nthe,Nr)


;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
polar_contour, z1,t[*,0],r[0,*],/
FILL,nlevels=nlev,title=tit,zr=[-0.3,RMAX]
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


close,2 "


Now when he runs it in his machine (with IDL version 6.2) it just
works like a charm but the same code breaks down when I want to run on
machine (with IDL 7.0).

As I showed on the code, program breaks down at weird places, like
"DEVICE,RETAIN=0"( shown above). It says that, retain is NOT allowed
for device command, how ridiculous!!!!!

Even if I circumvent this area, when it gets down to polar_contour
command, it says, it cannot plot since the points are collinear !! How
come then it works on his machine?????

As far as I can see, the code seems alright. I just cannot figure out
why it is breaking down on my machine.


Please help...!!!!!!!!

Best,

T
Re: Problem with Polar_contour [message #62165 is a reply to message #62083] Mon, 25 August 2008 17:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
tarequeaziz@gmail.com writes:

> why do we need to use 'triangulate' procedure to draw a polar_contour
> plot?

Because contour expects a rectangular Cartesian grid, and
you want to pass it something else, entirely. Thus, you are
going to have to re-grid your data to display it in this new
way. I would guess the polar points are causing you grief.
Probably all these spherical triangles are collapsing to a
point and appear to the triangulation algorithm to be co-linear.
It is a common problem, as you will see if you search the newsgroup
archives for "co-linear".

> please excuse my ignorance regarding this. because right now it
> seems like this is the last bone of contention. Triangulate is
> standing between me and the solution.

You may have to try some other way of gridding your data instead
of letting IDL attempt to solve the problem. IDL procedures exists
to help you do this. (MESH_DECIMATE, for example, helps to get
rid of overlapping vertices in the data.)

> BTW...have u noticed the uncanny resemblance between 'strangulation'
> and 'triangulation'....??

Not until just recently. :-)

I have a son who sometimes asks me to edit one of his papers. Then
he ignores my good suggestions and re-submits the paper to me for
further editing, and I make the same good suggestions (usually
concerning the difference between "there" and "their"), etc. This
conversation is beginning to remind me of that. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Problem with Polar_contour [message #62166 is a reply to message #62083] Mon, 25 August 2008 16:44 Go to previous message
tarequeaziz is currently offline  tarequeaziz
Messages: 20
Registered: November 2007
Junior Member
On Aug 25, 7:03 pm, David Fanning <n...@dfanning.com> wrote:
> tarequea...@gmail.com writes:
>> ---It is actually the 'same' data my colleague is using. The data was
>> generated by his fortran program. But after that, he uses IDL to do
>> all sorts of image processing.
>
> OK, are you sure, then, that this isn't a byte order
> problem? When you read the data, do the minimum
> and maximum values look OK to you? Are they in the
> range you expect? Have you put them in a variable
> that maintains all the precision of the data?
> Have you tried plotting the data as points instead
> of contouring it? Does it still look reasonable?
>
> Have you printed out t and r to see if those values
> look OK? Have you tried to display Z1 as a surface?
>
> Still a lot of possibilities left... :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Looks like its going to be a long night for me!
Anyways, one more question, and then I will let you go...I promise.

why do we need to use 'triangulate' procedure to draw a polar_contour
plot? please excuse my ignorance regarding this. because right now it
seems like this is the last bone of contention. Triangulate is
standing between me and the solution.

BTW...have u noticed the uncanny resemblance between 'strangulation'
and 'triangulation'....??

he he he ....
Re: Problem with Polar_contour [message #62167 is a reply to message #62083] Mon, 25 August 2008 16:03 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
tarequeaziz@gmail.com writes:

> ---It is actually the 'same' data my colleague is using. The data was
> generated by his fortran program. But after that, he uses IDL to do
> all sorts of image processing.

OK, are you sure, then, that this isn't a byte order
problem? When you read the data, do the minimum
and maximum values look OK to you? Are they in the
range you expect? Have you put them in a variable
that maintains all the precision of the data?
Have you tried plotting the data as points instead
of contouring it? Does it still look reasonable?

Have you printed out t and r to see if those values
look OK? Have you tried to display Z1 as a surface?

Still a lot of possibilities left... :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Problem with Polar_contour [message #62168 is a reply to message #62083] Mon, 25 August 2008 15:46 Go to previous message
tarequeaziz is currently offline  tarequeaziz
Messages: 20
Registered: November 2007
Junior Member
On Aug 25, 6:36 pm, David Fanning <n...@dfanning.com> wrote:
> tarequea...@gmail.com writes:
>> My God....!
>
>> You are RIGHT!!!!!
>
> Well, yes, but don't go crazy on me. If you
> check my record, I think you will see there is a better
> than average chance I am right about these kinds of things.
> I'm used to seeing bad IDL code. :-)
>
>> And just to add a little to this, why "polar_contour" gets all berserk
>> when its in my machine. As you can see, I use set_plot command long
>> after I used "polar_contour"...?
>
>> Does it have to do anything with the conflict between Linux and
>> Windows? It shouldn't..right???
>
> Right, it shouldn't.
>
> I'm thinking right at the moment that this is a red-herring.
> Maybe if you get the other things sorted out, this will sort
> itself out, too. If not, then tell me if this is *exactly*
> the same data that ran on your colleagues machine, or just
> data that you are trying to run. If the latter, have you
> tried making it double precision data?
>
>> I am sorry that I am asking too many questions, but you have no idea
>> how much you are helping me out in this.
>
> Well, goodness. Maybe you could write a short note to my
> wife. She thinks I goof off all day long. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")


"--- tell me if this is *exactly*
the same data that ran on your colleagues machine, or just
data that you are trying to run."

---It is actually the 'same' data my colleague is using. The data was
generated by his fortran program. But after that, he uses IDL to do
all sorts of image processing.


" --Well, goodness. Maybe you could write a short note to my
> wife. She thinks I goof off all day long. :-)"

---ha ha ha .....if this helps, I am willing to write a very nice
testimonial for you!
All I need is her email address....ha ha ha ...
Re: Problem with Polar_contour [message #62169 is a reply to message #62083] Mon, 25 August 2008 15:36 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
tarequeaziz@gmail.com writes:

> My God....!
>
> You are RIGHT!!!!!

Well, yes, but don't go crazy on me. If you
check my record, I think you will see there is a better
than average chance I am right about these kinds of things.
I'm used to seeing bad IDL code. :-)

> And just to add a little to this, why "polar_contour" gets all berserk
> when its in my machine. As you can see, I use set_plot command long
> after I used "polar_contour"...?
>
> Does it have to do anything with the conflict between Linux and
> Windows? It shouldn't..right???

Right, it shouldn't.

I'm thinking right at the moment that this is a red-herring.
Maybe if you get the other things sorted out, this will sort
itself out, too. If not, then tell me if this is *exactly*
the same data that ran on your colleagues machine, or just
data that you are trying to run. If the latter, have you
tried making it double precision data?

> I am sorry that I am asking too many questions, but you have no idea
> how much you are helping me out in this.

Well, goodness. Maybe you could write a short note to my
wife. She thinks I goof off all day long. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Problem with Polar_contour
Next Topic: Having trouble stopping a loop (or loop de loop de loop)

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

Current Time: Thu Oct 09 09:18:31 PDT 2025

Total time taken to generate the page: 0.16275 seconds