Re: polar coordinate plots with NCAR graphics?

From: David Kennison <kennison_at_nyahnyahspammersnyahnyah>
Date: Wed, 29 Mar 2006 08:51:31 -0700

Joe,

I have attached a FORTRAN program, built around the code you provided,
that I think will do what you want; the plot it produces is also
attached. I made two or three changes in your code, but the important
one was to supply a call to SET. (If you tell CONPACK not to call SET,
you have to do it yourself.) You say that you tried this, but you must
not have used the proper arguments.

I have arranged for my data, like yours, to have a min of 0 and a max
of 20 and I also get only 18 contours. This is as it should be. Since
the field values on one side of a contour are less than the contour
level and the field values on the other side are greater than the
contour level, one cannot expect to have any contour line drawn when
using a contour level equal to either the max or min in the field.

Dave Kennison

On Mar 28, 2006, at 7:50 PM, jprusa wrote:

>> Hi:
>>
>> I'm trying to plot contours using polar coordinates. This should be a
>> straightforward adaptation of contour plots using xy Cartesians. The
>> primary problem is that I'm unable to plot whole field, only 1st
>> quadrant.
>>
>> The code I've written to do this plot is:
>>
>> ===========================================================
>>
>> nct=20 ! number of contours
>> cmn=0.0 ! field minimum contour
>> cmx=1.0 ! field maximum contour
>> cnt=(cmx-cmn)/float(nct-1) ! contour interval
>> xm=float(m)
>> call cpsetr ('VPL - VIEWPORT LEFT' ,0.0)
>> call cpsetr ('VPR - VIEWPORT RIGHT' ,1.0)
>> call cpsetr ('VPB - VIEWPORT BOTTOM',0.0)
>> call cpsetr ('VPT - VIEWPORT TOP' ,1.0)
>>
>> call cpsetr ('T2D - TENSION ON 2D SPLINES',0.)
>> call cpseti ('LLP - LINE LABEL POSITIONING',3)
>>
>> call cpseti ('CLS - CONTOUR LEVEL SELECTION',nct)
>> call cpsetr ('CMN - min',cmn)
>> call cpsetr ('CMX - max',cmx)
>> call cpsetr ('CIS - interval',cnt)
>>
>> call cpseti ('MAP - mapping',2)
>> call cpsetr ('XC1 - minimum r' , 0.)
>> call cpsetr ('XCM - maximum r' , xm)
>> call cpsetr ('YC1 - minimum angle', 0.)
>> call cpsetr ('YCN - maximum angle',360.)
>>
>> call cpsetr ('ORV - outofrange val',1.e12)
>> call cpseti('SET - turn off set',0)
>>
>> call cprect (tt,m,m,n,rwrk,lrwk,iwrk,lrwk)
>> call cpcldr (tt,rwrk,iwrk)
>>
>> call frame
>>
>> ===========================================================
>>
>>
>> This frame is embedded between several other "standard" xy plot
>> frames that
>> work just fine (both contours only and contours with color). The key
>> changes
>> should be to set MAP=2 and values XC1 <= radius <= XCM and YC1<=
>> polar
>> angle <= YCM.
>>
>> This code "sort of" works. It does give a polar plot BUT ONLY THE 1ST
>> QUADRANT,
>> eg, from 0 <= polar angle <= 90 degrees. I want full plane and
>> thought I had set it
>> so with YCN=360.
>>
>> If I set YCN=90., then all the data is plotted in the region 0 to 90
>> degrees. It is
>> "squeezed" and distorted, but all there. With YCN=360., the result in
>> the 1st
>> quadrant is fine, ie, it draws the contours correctly and without
>> distortion, but it is
>> drawing only 1/4 of data field... Since the code plots whole array if
>> YCN =90 or
>> less degrees; and other xy plots show whole field no problem, I am
>> confident
>> this is not an issue with reading in data array to be contour plotted
>> (the xy
>> Cartesian plots are perfectly done).
>>
>> I've tried setting XC1=-xm but that gives bizarre result with
>> contours folding over
>> each other which is not correct. I've also tried using "call set" to
>> redefine the plotting
>> area, and alternately "call cpsetr ('WDL...") etc. I've only
>> succeeded in making things
>> worse.
>>
>> A second problem is that the plot DOES NOT SHOW the max (cmx=1.0)
>> and min (cmn=0.)
>> contours which would define the boundary circle. I've set it to draw
>> nct=20 contours, but
>> only the 18 in the interior are drawn. Why are min/max contours not
>> being drawn?
>>
>> Any help would be greatly appreciated. It you can see it, a pdf of
>> the polar contour
>> plot is attached below. The correct result should be (approximately
>> ) symmetrical
>> about lines x=0 and y=0 ( there is about a 7 degree rotation).
>> The origin is located in the lower left corner, where 2 contours are
>> "pinched" together a bit. The origin OUGHT to be in the MIDDLE of the
>> plot.
>>
>> Best regards,
>> Joe Prusa
>
> <1st_quad_only.pdf>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Wed Mar 29 2006 - 08:51:31 MST

This archive was generated by hypermail 2.2.0 : Thu Mar 30 2006 - 15:04:31 MST