Re: pdfx function

From: Maria Gehne <mgehne_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 02 2013 - 11:38:30 MDT

Hi Cecille,

it seems to me there are several issues here.

First, you define opt@bin_min = -30 which is fine. But if you look at
the documentation for pdfx
http://www.ncl.ucar.edu/Document/Functions/Contributed/pdfx.shtml
the return value (your ap) does not have bin_min as an attribute, rather
it has bin_bound_min. Maybe that's what you want?

The other issue is the first error message you get. There are no
non-missing values in w1 at the level you specify.
This probably also causes the errors when you try to plot, because there
are no valid values in ap. I don't know what NCL returns in that case.
If it is a vector of the same length as nbin with all missing values or
just a missing value.

I hope this helps,
Maria

On 10/02/2013 09:41 AM, Cecille Villanueva wrote:
> Hello ncl-talk,
>
> I am trying to make pdfs of vertical velocities at different
> heights within a cloud where the cloud mixing ratio exceeds 1 g/kg. I
> have specified the bin_spacing, the bin_boundaries and the number of
> bins. From my understanding the pdfx function should ignore missing
> values and obtain these attributes. However, when I run the script, is
> like those attributes are not passed when the pdfs are calculated and
> I get the following error,
>
> (0)pdfx: nGood=0 : Need more non-missing points
> warning:Attempt to reference attribute (bin_min) which is undefined
> (0)-2147483647
> warning:Attempt to reference attribute (bin_center) which is undefined
> (0)gsn_csm_xy: Fatal: X and Y must have the same dimensions sizes, or
> one must be one-dimensional and both have the same rightmost dimension.
> fatal:CheckArray:Each vector in the caXArray array must have at least
> 2 elements
> fatal:CoordArraysInitialize:caXArray resource is invalid
> fatal:Unable to initialize layer-Can't Create
> fatal:Unable to access object with id:-4
> fatal:PID #-4 can't be found in NhlSetValues
> fatal:PID #-4 can't be found in NhlSetValues
> fatal:Unable to access object with id:-4
> warning:Unable to add DataItem "(null)" to DataList "xyCoordData"
> fatal:CompileDataList:DataList has no valid members
> fatal:Unable to access object with id:-4
> warning:Unable to add DataItem "(null)" to DataList "xyCoordData"
> fatal:CompileDataList:DataList has no valid members
> fatal:Argument type mismatch on argument (0) of (attsetvalues_check)
> can not coerce
> fatal:Execute: Error occurred at or near line 10802 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>
> fatal:Execute: Error occurred at or near line 4837 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
>
> fatal:Execute: Error occurred at or near line 188 in file WRF_pdf.ncl
>
>
> The part of the script that does the calculation is shown below.
>
>
> ;------------------------------------------------
> ; Plot each PDF
> ;------------------------------------------------
> opt = True
> delt_bin = 1
> opt@bin_spacing = delt_bin
> max_ws = 30
> min_ws= -30
> opt@bin_min = min_ws
> opt@bin_max = max_ws
> nbins = floattointeger((max_ws - min_ws)/delt_bin)
>
>
> ; nTot_bins = new( nbins, "double")
> ; nTot_bins = nTot
>
> ;print(nTot_bins)
>
> w1 = new((/num_vert,num_horiza,num_horizb/), float, getFillValue(w))
>
> w1 = where(qc.ge.0.0001,w,w@_FillValue)
> ; w1 = where(qc.ge.0.0001,w,0)
> ;print(w1)
> ap = pdfx(w1(level,:,:), nbins, opt)
> print(ap@bin_min)
>
> ;print(ap)
>
> ; ap = where(nTot_bins.ne.0.,100d0*pdf/nTot_bins,0) ; CMV
> - percent frequency
>
> ; nVar = 3
> ; plot = new ( nVar, "graphic")
>
> ; wks = gsn_open_wks ("pdf","w_pdf")
>
> res = True
> ; res@gsnDraw = False
> ; res@gsnFrame = False
> res@xyLineThicknessF = 2
> res@tiYAxisString = "PDF (%)"
> ; res@tiYAxisString = "PDF (Frequency)"
> res@tiMainString = timelabl(it)+", "+z_avg(level)+" km"
>
> res@gsnCenterString = "Univariate PDF: Normal"
> plot = gsn_csm_xy (wks, ap@bin_center, ap, res)
>
>
> end do
>
> Why is it that when I print the bin_min it comes as -2147483647 and
> not -30 as I specified above?
>
> The w variable is set to a missing value when this threshold is not
> met so the 0 m/s data points don't go into the pdf. I also ran the
> script changing contributed.ncl to make pdf = 0 when only missing
> values were encountered and I get the same error. Any help will be
> greatly appreciated. Let me know if you need the whole script and data
> file.
>
> Cheers,
> Cecille
>
>> ********************************************************
>> Cecille M. Villanueva Birriel
>> Ph.D. Candidate
>> Cloud Microphysics Research Group
>> Purdue University
>> Department of Earth, Atmospheric, & Planetary Sciences
>> 550 Stadium Mall Drive, West Lafayette, IN 47907-2051
>> email: cvillanu@purdue.edu <mailto:cvillanu@purdue.edu>
>> ********************************************************
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
Maria Gehne
Postdoctoral Fellow
NCAR/CGD/CAS
P.O. Box 3000
Boulder, CO 80307

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 2 11:38:41 2013

This archive was generated by hypermail 2.1.8 : Fri Oct 04 2013 - 16:45:17 MDT