Re: plotting pdf

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 21 2011 - 14:55:44 MST

Hi Sara,
Sorry I missed this yesterday. I suspect that you would still have the same problem if you based your code on xy_30.ncl. In fact I tried it and found that there is indeed too much irregularity in the axis points for the spline approximation code to work. I suggest that since the axis you propose is actually logarithmic, you go back to using a logarithmic axis. It is true that you will need to work around the problem of values equal to 0, but I think you could do that by assigning small positive values, one or two orders of magnitude less than your smallest non-zero values, to your 0 values.

Here is a simple xy plot script that represents values with a range of more than 16 orders of magnitude. It uses the 'where' function to set 0 values to a value several orders of magnitude smaller than the otherwise smallest value. Hope this helps.
 -dave

-----
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;

  res = True
  res@trXMinF = -50
  res@trXMaxF = 550
  res@trYMinF = 1e-11
  res@trYMaxF = 1e11
  res@trYAxisType = "LogAxis"
  wks = gsn_open_wks ("x11","xy") ; open workstation

  data = exp(fspan(-20,20, 500))
  print(min(data) + " " + max(data))
  data(0) = 0
  data = where(data .eq. 0, 1e-12, data)
  print(min(data) + " " + max(data))
  plot = gsn_y(wks,data,res)

On Dec 21, 2011, at 6:03 AM, Mary Haley wrote:

> Hi Sara,
>
> I was hoping that Dave might weigh in here, as I'm not familiar with
> how xyYIrregularPoints is supposed to work.
>
> But, I think there's another way you can do this.
>
> Please see example xy_30.ncl at:
>
> https://www.ncl.ucar.edu/Applications/xy.shtml#ex30
>
> This shows you how to get an "irrgeular" axis using
> trYIrregularPoints. It's not very trivial, unfortunately, but this
> example should help.
>
> If you already have version 6.0.0 of NCL, then you can remove the
> "gsn_csm_blank_plot" function that's defined in this example, as it is
> included in $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.
>
> --Mary
>
>
> On Dec 20, 2011, at 12:39 PM, Sara A. Rauscher wrote:
>
>> Hi,
>> I am having trouble plotting a pdf I calculated using the function
>> pdfx. On the x-axis I have 120 bins of 10 mm/day each, going from 0
>> to 1200 mm/day. On the y-axis is the percentage of time, which I
>> would like to be equally spaced from 10 (top) to 10e-8 (bottom).
>> (See the attached image from Williamson 2008). Because the values
>> are extremely small or 0 for some of the bins, a log axis
>> (res@trYLog = True) doesn't work. I've tried using an irregular
>> axis:
>>
>> res@trYAxisType = "IrregularAxis"
>> res@trYMinF = 10e-8
>> res@trYMaxF = 10
>> res@xyYIrregularPoints = (/
>> 10e-8,10e-7,10e-6,10e-5,10e-4,10e-3,10e-2,10e-1,1,10/)
>>
>> but then I get an error message
>>
>> warning:_NhlCreateSplineCoordApprox: Attempt to create spline
>> approximation for Y axis failed: consider adjusting trYTensionF value
>> warning:IrTransInitialize: error creating spline approximation for
>> trYCoordPoints; defaulting to linear
>>
>> which I looked up and it means the spacing of the coordinate array
>> is too irregular - but that's how I need it to be. Can I get around
>> this somehow?
>>
>>
>> thanks
>> sara
>>
>> --
>> Sara A. Rauscher
>> (505) 606-0512
>> T-3 Fluid Dynamics
>> MS B216
>> Los Alamos National Lab
>> Los Alamos, NM 87545 USA
>>
>>
>> <TELA_340_f5_thumb.gif>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 21 14:55:53 2011

This archive was generated by hypermail 2.1.8 : Wed Jan 04 2012 - 10:18:09 MST