# Re: calculating quartiles

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 04 Sep 2009 08:28:26 -0600

For a single series,
http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml
-------
If there are a large number of series, you will have to use
two steps [untested]

[1]
http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml
with kflag=2 [sort each series into ascending order]

[2]
If there are no missing values and the length of each series is N,
then for (say) x(time,lat,lon) and the number of time steps is N

ip = dim_pqsort_n(x, 2, 0) ; 0 it the 'time' dimension

nLow = N/4 -1 ; the -1 is because NCL is zero based
xLowQuart = x(nLow,:,:)

nUp = 3*N/4-1
xLowQuart = x(nUp,:,:)
--------

If there are missing values [_FillValue] in the time dimension,
you would also have the use

nVal = dim_num_n(x,0)

and then use these in the nLow/nUp indices.

Good luck

Stergios Misios wrote:
> hi all,
> is there any function for calculating the 25th and 75th quartile of a
> time series? i looked on function list and i could find a function only
> for median...
>
> Thank you very much,
> Stergios
> _______________________________________________
> 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 Fri Sep 04 2009 - 08:28:26 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 08 2009 - 11:49:50 MDT