Problem with Polar_contour

This is a discussion on Problem with Polar_contour within the Idl-pvwave forums in Programming Languages category; 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 ...

Go Back   Application Development Forum > Programming Languages > Idl-pvwave

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-25-2008, 03:46 PM
tarequeaziz@gmail.com
Guest
 
Default Problem with Polar_contour


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





Reply With Quote
  #2  
Old 08-25-2008, 03:53 PM
David Fanning
Guest
 
Default Re: Problem with Polar_contour

tarequeaziz@gmail.com writes:

> 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.


My guess is your device is "PS" and his device is "X" or "WIN".
These commands are not allowed in the PostScript device.
To see what device you are in, type this:

HELP, /DEVICE

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.")
Reply With Quote
  #3  
Old 08-25-2008, 05:16 PM
tarequeaziz@gmail.com
Guest
 
Default Re: Problem with Polar_contour

On Aug 25, 3:53*pm, David Fanning <n...@dfanning.com> wrote:
> tarequea...@gmail.com writes:
> > 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.

>
> My guess is your device is "PS" and his device is "X" or "WIN".
> These commands are not allowed in the PostScript device.
> To see what device you are in, type this:
>
> * HELP, /DEVICE
>
> 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.")


Thanks Dave,


I really appreciated your prompt reply!!!

As per your advice, I checked it. My device is set as "WIN"
here's what I got:


"Available Graphics Devices: CGM HP METAFILE NULL PCL PRINTER PS WIN Z
Current graphics device: WIN
Screen Resolution: 1680x1050
Simultaneously displayable colors: 16777216
Number of allowed color values: 16777216
System colors reserved by Windows: 0
IDL Color Table Entries: 256
NOTE: this is a TrueColor device
NOT using Decomposed color
Graphics Function: 3 (copy)
Current Font: System, Current TrueType Font: <default>
Default Backing Store: None. "


What do you think???


Best,

T
Reply With Quote
  #4  
Old 08-25-2008, 05:46 PM
David Fanning
Guest
 
Default Re: Problem with Polar_contour

tarequeaziz@gmail.com writes:

> As per your advice, I checked it. My device is set as "WIN"
> here's what I got:
>
>
> "Available Graphics Devices: CGM HP METAFILE NULL PCL PRINTER PS WIN Z
> Current graphics device: WIN
> Screen Resolution: 1680x1050
> Simultaneously displayable colors: 16777216
> Number of allowed color values: 16777216
> System colors reserved by Windows: 0
> IDL Color Table Entries: 256
> NOTE: this is a TrueColor device
> NOT using Decomposed color
> Graphics Function: 3 (copy)
> Current Font: System, Current TrueType Font: <default>
> Default Backing Store: None. "
>
>
> What do you think???


I think your colleague runs on LIXUX machines and programs
accordingly. :-)

Windows can certainly accept a DEVICE, RETAIN=0 command, so
I don't know why that should fail. Still smacks of PostScript
to me. DEVICE, TRUE_COLOR=xxx is going to fail on Windows,
since that is not how you set up a True-Color device on Windows.
And, anyway, as you can see, you already ARE a 24-bit device,
so the command is unnecessary.

There isn't a SET_PLOT, 'X' somewhere in the code, is there?

I really don't know. Strange errors. :-)

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.")
Reply With Quote
  #5  
Old 08-25-2008, 05:57 PM
tarequeaziz@gmail.com
Guest
 
Default Re: Problem with Polar_contour

On Aug 25, 5:46*pm, David Fanning <n...@dfanning.com> wrote:
> tarequea...@gmail.com writes:
> > As per your advice, I checked it. My device is set as "WIN"
> > here's what I got:

>
> > "Available Graphics Devices: CGM HP METAFILE NULL PCL PRINTER PS WIN Z
> > Current graphics device: WIN
> > * * Screen Resolution: 1680x1050
> > * * Simultaneously displayable colors: 16777216
> > * * Number of allowed color values: 16777216
> > * * System colors reserved by Windows: 0
> > * * IDL Color Table Entries: 256
> > * * NOTE: this is a TrueColor device
> > * * NOT using Decomposed color
> > * * Graphics Function: 3 (copy)
> > * * Current Font: System, *Current TrueType Font: <default>
> > * * Default Backing Store: None. *"

>
> > What do you think???

>
> I think your colleague runs on LIXUX machines and programs
> accordingly. :-)
>
> Windows can certainly accept a DEVICE, RETAIN=0 command, so
> I don't know why that should fail. Still smacks of PostScript
> to me. DEVICE, TRUE_COLOR=xxx is going to fail on Windows,
> since that is not how you set up a True-Color device on Windows.
> And, anyway, as you can see, you already ARE a 24-bit device,
> so the command is unnecessary.
>
> There isn't a SET_PLOT, 'X' somewhere in the code, is there?
>
> I really don't know. Strange errors. :-)
>
> 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.")



My God....!

You are RIGHT!!!!!

Its true that my buddy works in Linux. and yes, there is a
'set_plot,x' command.

Actually here's the rest of the code( this starts right after the
polar_contour command):


"
..........
close,2

set_plot,'ps'
device, filename=fileout,/encapsulated,/color, xsize=aaax, ysize=aaay

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

device,/close_file

set_plot,'x'



close,/all "


The 'retain' thing actually is working fine. I guess, I was confusing
the machine too much so it kinda gave up on me....he he he ...

As you mentioned,"True color" command is not being accepted for
obvious reason.

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???

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

:-)
Thanks once again

Best,

T



Reply With Quote
  #6  
Old 08-25-2008, 06:36 PM
David Fanning
Guest
 
Default Re: Problem with Polar_contour

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.")
Reply With Quote
  #7  
Old 08-25-2008, 06:46 PM
tarequeaziz@gmail.com
Guest
 
Default Re: Problem with Polar_contour

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 ...









Reply With Quote
  #8  
Old 08-25-2008, 07:03 PM
David Fanning
Guest
 
Default Re: Problem with Polar_contour

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.")
Reply With Quote
  #9  
Old 08-25-2008, 07:44 PM
tarequeaziz@gmail.com
Guest
 
Default Re: Problem with Polar_contour

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 ....
Reply With Quote
  #10  
Old 08-25-2008, 08:09 PM
David Fanning
Guest
 
Default Re: Problem with Polar_contour

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.")
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:30 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.