[Thread Prev][Thread Next][Index]

Re: [ferret_users] median averager, not a smoother



Hi Andrew,

Thank you for echoing the suggestion and providing a nice workaround. The sample* functions are among the least familiar to me (I'm not even sure that I've used them before). I learned.

Thanks,
David

On Sun, Oct 25, 2009 at 10:02 AM, Andrew Wittenberg <Andrew.Wittenberg@xxxxxxxx> wrote:
Building on this suggestion, it'd be even better to have a "quantile transformation," e.g.

  variable[t=@QNT:.5]

would return the temporal median and

  variable[t=@QNT:.9]

would return the temporal 90th percentile.

Here's a sample script showing one way to do the quantile interpolation for a 1-dimensional time-oriented variable:

! Usage: go quantile variable_1d [quantile var_out]
!                          $1    [   $2      $3   ]
! Return a quantile of a one-dimensional variable.
! The quantile value is interpolated if necessary.
! Default is the median (0.5 quantile).

let q_idx = 1 + $2".5" * (`$1,r=lend`-1)
let q_sort = samplel($1,sortl(($1)))
let q_val = q_sort[t=`q_idx`]
let $3"quantile" = `q_val`


Andrew


David Wang wrote:
Dear Ferret developers,

I appreciate the recent, useful addition of median transformation smoother @MED into Ferret. Sometimes, however, I find myself (probably others as well) in need of a median averager, much like @AVE as an arithmetic averager. For instance, I'd like to get the median of a time series and use the resultant scalar in other expressions. I wonder if such a transformation could be implemented into future Ferret release.

Thanks,
David

--
turn and live.



--
turn and live.

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement