Re: odd wrapping behavior w/ logarithmic axis for xy plot

From: David Ian Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue, 1 Aug 2006 11:28:59 -0600

Actually just FYI, the problem is *not* specifying a value greater than
the min data value for
trXMinF. For example, if you specify res_at_trXMinF = 0.01 (which is the
same as the theoretical
value of 5 * x(0), but because of floating point error, not quite the
actual value) it works.
The problem actually involves cases where a data value is almost but
not quite
identical to the trXMinF value. There is a calculation that fails to
converge in some cases.
I'm hoping I have a solution.
  -dave

On Jul 31, 2006, at 11:08 PM, Dennis Shea wrote:

>> When I run the attached ncl script foo.ncl, I get the attached eps
>> file. The script is plotting y=x & y=x^2, 0<x<=1, with a logarithmic
>> x axis style. The x values in the y=x^2 curve appears to be wrapping
>> around and producing an incorrect curve on the figure.
>>
>> Any idea what is going wrong and how to fix it and/or work around it?
>>
>> This is a simplified script. My application of interest is a power
>> spectrum density figure that I am attempting to generate. In that
>> figure, I am getting a similar wraparound effect.
> ____________________________________________________
>
> The following illustrates what works and fails.
> Basically, "5.0 * x(0)" specifies that the user specified trXMinF is
> to the right (ie, > min(alog10(x))
>
> [1]
> res_at_xyXStyle = "Log"
> res_at_trXMaxF = 1.0
> ;res_at_trXMinF = 5.0 * x(0) ; fails
> res_at_trXMinF = x(0) ; works
> ;res_at_trXMinF = 0.001 ; works
> res_at_trYMaxF = 1.0
> res_at_trYMinF = -1.0
>
> [2] Commenting the following
> ;res_at_xyXStyle = "Log"
> means all the above res_at_trXMinF settings work.
>
> [3] Keith wants
>
> res_at_trXMinF = 5.0 * x(0)
>
> so a work around is
>
> res_at_trXMinF = 5.0 * x(0)
> res_at_xyXStyle = "Log"
>
> i = ind(x.ge.res_at_trXMinF)
> p = gsn_xy(wks,x(i),y(:,i),res)
>
> [4] Basically there appears to be a bug when
> xyXStyle = "Log"
> and the user specifies trXMinF to be greater than the actual
> min value of the series.
>
>
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> begin
> N = 500
> x = (1.0 * ispan(1,N,1)) / N
> y = new( (/ 2, N /), float )
>
> y(0,:) = x
> y(1,:) = x ^ 2
>
> xx = log10(x)
> print( x(0:10)+" "+y(0,0:10)+" "+y(1,0:10)+" "+xx(0:10) )
> ;print( x+" "+xx+" "+y(0,:)+" "+y(1,:) )
>
> wks = gsn_open_wks("x11", "foo")
>
> res = True
> res_at_trXMaxF = 1.0
> ;res_at_trXMinF = 5.0 * x(0) ; fails
> ;res_at_trXMinF = x(0) ; works
> res_at_trXMinF = 0.001 ; works
> res_at_trYMaxF = 1.0
> res_at_trYMinF = -1.0
> res_at_xyXStyle = "Log"
> res_at_xyLineThicknessF = 2
>
> p = gsn_xy(wks,x,y,res)
>
> end
> _______________________________________________
> 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 Tue Aug 01 2006 - 11:28:59 MDT

This archive was generated by hypermail 2.2.0 : Tue Aug 01 2006 - 16:53:56 MDT