[ncl-talk] using stat_dispersion over a region

Dennis Shea shea at ucar.edu
Wed Jun 1 07:43:28 MDT 2016


The answer is "yes" and "no"   :-)

stat_dispersion can be used on an array.

http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml

function stat_dispersion (
		x    : numeric,    <=== An array of any numeric type.
		opt  : logical
	)

	return_val <http://www.ncl.ucar.edu/Document/Functions/return_val.shtml>
 :  [30]


----
It returns a one-dimensional array of length 30

   Let x(time,lat,lon)

   opt = ...

   xx  = stat_dispersion( x(:,{20:35},{270:300}), opt)

will return the statistics for the entire region.
Example 2 also shows usage for arrays.

Since, geophysical variables may be spatially and temporally correlated,
this may be the best approach.

---
However, if you want statistics at each grid point, then 'yes' a loop must
be used.

    grid_stats = new ( (/nlat,mlon/), typeof(x), getFillvalue(x))
    do nl=nlStrt,nlLast
      do ml=mlStrt,mlLast

         grid_stats(nl-nlStrt,ml-mlStrt) = stat_dispersion( x(:,nl,ml), opt)

      end do
   end do

   copy_VarCoords(x(:,nlStrt:nlLast,mlStrt:mlLast), grid_stats)
   grid_stats at long_name = "stat_dispersion at individual grid points"
   printVarSummary(grid_stats)

I think this would be pretty quick.

===
You could also use

http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml

and then extract the desired percentiles.

Good Luck

On Wed, Jun 1, 2016 at 6:21 AM, Noelia otero <noeli1680 at gmail.com> wrote:

> Hi,
>
> I wanted to get and plot the 95th percentile over a region, which means
> that I have data for over:  [lat lon time]
> I was going to use the stat_dispersion, but given that this (to my
> understanding) only applies to one time serie, to get the 95th percentile
> in each grid [lat lon] , I should use a loop over each point, shouldn't I?
>
> I was gondering if there would be another function to do that or another
> better way.
>
> Many thanks
>
> Cheers
>
> Noelia
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160601/6be96ac8/attachment.html 


More information about the ncl-talk mailing list