Re: 10th and 90th percentile

From: Carl Schreck <cjschrec_at_nyahnyahspammersnyahnyah>
Date: Mon Apr 14 2014 - 08:55:01 MDT

Here's a library with a couple functions I use for this purpose. They allow
you to either specify a value and find the percentile (e.g., what
percentile would 3.21 be in my array?) or vice versa (e.g., what value
would the 10th percentile have?).

    Carl

On Mon, Apr 14, 2014 at 8:24 AM, jbuzan <jbuzan@purdue.edu> wrote:

> stat_dispersion
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml
>
> -Jonathan
>
>
>
> On Apr 14, 2014, at 8:23 AM, Marston Johnston <shejo284@gmail.com> wrote:
>
> Here's an example that I made for my own use. It uses a function designed
> to keep only non-missing values, which is simple to make.
>
> undef("Percentile")
> function Percentile(x:numeric,P:float)
> begin
> if(P.gt.0) then
> P = P/100.
> end if
> x@_FillValue = default_fillvalue(typeof(x))
> print("Rain rates for project greater than 0 and less than 1000...")
> x = where((x.gt.0 .and. x.lt.1000.),x,x@_FillValue)
> nx = Crop(ndtooned(x))
> index = round(P*dimsizes(nx),3)
> print("Index of percentile: "+index+ " of size: "+dimsizes(nx))
> ib = dim_pqsort(nx,2)
> print("The "+P*100+" percentile: "+nx(index))
> return(nx(index))
> end
>
> Hope this helps,
> /M
>
>
> On Mon, Apr 14, 2014 at 2:16 PM, Ahmad Farsyud <a.farsyud@gmail.com>wrote:
>
>> Hi Marston, thanks,
>> could you suggest me an example?
>>
>>
>> On Mon, Apr 14, 2014 at 2:13 PM, Marston Johnston <shejo284@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> I've not seen such a function in NCL, but it's fairly simple to code in
>>> NCL.
>>> It involves sorting your array, make it 1D first, removing any invalid
>>> data points, and then
>>> calculating the 10th and 90th percentile position in the array. The 10th
>>> and 90th are positions of the
>>> 10% and 90% indices in the array.
>>>
>>> Hope this helps,
>>>
>>> /M
>>>
>>>
>>> On Mon, Apr 14, 2014 at 2:03 PM, Ahmad Farsyud <a.farsyud@gmail.com>wrote:
>>>
>>>> Dear NCL,
>>>>
>>>> Anyone can suggest what a function that i can use to calculate 10th and
>>>> 90th percentile in NCL?
>>>>
>>>> Thanks
>>>> AF
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>>
>>> --
>>> Only the fruitful thing is true!
>>>
>>
>>
>
>
> --
> Only the fruitful thing is true!
> _______________________________________________
> 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
>
>

-- 
 <http://www.cicsnc.org/>
 <http://www.researcherid.com/rid/B-8711-2011>[image:
http://www.researcherid.com/rid/B-8711-2011]<http://www.researcherid.com/rid/B-8711-2011>
*Carl J. Schreck III, PhD*
*Research Associate*
Cooperative Institute for Climate and Satellites NC <http://cicsnc.org/>
North Carolina State University <http://ncsu.edu/>
NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
151 Patton Ave, Asheville, NC 28801
e: cjschrec@ncsu.edu
o: +1 828 257 3140
CycloneCenter.org: Help analyze tropical cyclones<http://cyclonecenter.org/>
monitor.cicsnc.org/mjo: See recent MJO
diagnostics<http://monitor.cicsnc.org/mjo/>


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Mon Apr 14 08:55:53 2014

This archive was generated by hypermail 2.1.8 : Tue Apr 15 2014 - 10:45:19 MDT