<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>The answer is &quot;yes&quot; and &quot;no&quot;   :-)<br><br>stat_dispersion can be used on an array. <br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml">http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml</a><br><br><pre>function stat_dispersion (
                x    : numeric,    &lt;=== An array of any numeric type.
                opt  : logical   
        )

        <a href="http://www.ncl.ucar.edu/Document/Functions/return_val.shtml">return_val</a>  :  [30]
</pre>
<br>----<br></div>It returns a one-dimensional array of length 30<br><br></div>   Let x(time,lat,lon)<br><br></div><div>   opt = ...<br><br></div>   xx  = stat_dispersion( x(:,{20:35},{270:300}), opt)<br><br></div>will return the statistics for the entire region.<br></div>Example 2 also shows usage for arrays.<br><br></div>Since, geophysical variables may be spatially and temporally correlated, this may be the best approach.<br><br>---<br></div>However, if you want statistics at each grid point, then &#39;yes&#39; a loop must be used.<br><br></div><div>    grid_stats = new ( (/nlat,mlon/), typeof(x), getFillvalue(x))<br></div>    do nl=nlStrt,nlLast<br></div>      do ml=mlStrt,mlLast<br><br></div>         grid_stats(nl-nlStrt,ml-mlStrt) = stat_dispersion( x(:,nl,ml), opt)<br><br></div>      end do<br></div>   end do<br><br></div>   copy_VarCoords(x(:,nlStrt:nlLast,mlStrt:mlLast), grid_stats)<br></div>   grid_stats@long_name = &quot;stat_dispersion at individual grid points&quot;<br></div>   printVarSummary(grid_stats)<br><br></div><div>I think this would be pretty quick.<br></div><div><br></div>===<br>You could also use <br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml</a><br><br></div>and then extract the desired percentiles.<br><br></div>Good Luck<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 1, 2016 at 6:21 AM, Noelia otero <span dir="ltr">&lt;<a href="mailto:noeli1680@gmail.com" target="_blank">noeli1680@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I wanted to get and plot the 95th percentile over a region, which means that I have data for over:  [lat lon time] </div><div><div>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&#39;t I? </div></div><div><br></div><div>I was gondering if there would be another function to do that or another better way.</div><div><br></div><div>Many thanks</div><div><br></div><div>Cheers</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Noelia</div></font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>