<div dir="ltr"><div><div>[1] There is no indication that you sent any previous email with this topic.<br><br>[2] I am not clear on what is desired. Maybe:<br><br><br> ntim = 10000<br> klev = 50<br> nrad = 75<br><br> data = random_uniform(0, 500, (/ntim,klev,nrad/) ) ; dimension #: (0, 1, 2)<br> data@_FillValue = -999.0<br><br> data!0 = "time"<br> data!1 = "level"<br> data!2 = "radii"<br><br> rmin = 100.<br> rmax = 250.<br><br> data_rmin = where(data.lt.rmin, data, data@_FillValue)<br> data_rmax = where(data.gt.rmax, data, data@_FillValue)<br> data_rmnx = where(data.lt.rmin .or. data.gt.rmax, data@_FillValue, data)<br><br> copy_VarMeta(data, data_rmin)<br> copy_VarMeta(data, data_rmax)<br> copy_VarMeta(data, data_rmnx)<br><br> ndim = 2 ; radii dimension<br><br> data_avg_rmin = dim_avg_n_Wrap(data_rmin, ndim)<br> data_avg_rmin@long_name = "Average of all radii < "+rmin<br> printVarSummary(data_avg_rmin)<br> printMinMax(data_avg_rmin,0)<br> print("---")<br><br> data_avg_rmax = dim_avg_n_Wrap(data_rmax, ndim)<br> data_avg_rmax@long_name = "Average of all radii > "+rmax<br> printVarSummary(data_avg_rmax)<br> printMinMax(data_avg_rmax,0)<br> print("---")<br><br> data_avg_rmnx = dim_avg_n_Wrap(data_rmnx, ndim)<br> data_avg_rmnx@long_name = "Average of all values between rmin= "+rmin+" and rmax="+rmax<br> printVarSummary(data_avg_rmnx)<br> printMinMax(data_avg_rmnx,0)<br> print("---")<br><br>++++++++++++++++++++++++++++++<wbr>++<br>++++++++++++++++++++++++++++++<wbr>++<br><br></div>Note that <b>clarity is best</b> but you could avoid the creation of a temporary array via:<br><br>data_avg_rmin = dim_avg_n_Wrap(where(<a href="http://data.lt">data.lt</a>.<wbr>rmin, data, data@_FillValue), ndim)<br><br></div>etc<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 9, 2018 at 8:23 AM, Prashanth Bhalachandran <span dir="ltr"><<a href="mailto:prashanth.bhalachandran@gmail.com" target="_blank">prashanth.bhalachandran@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear NCL’ers, <br>
I have a 3 dimensional variable say M (time x level x radius). Now, I know the certain radius RMW at each level (RMW is a function of level) . For each time, I’d to average the variable within the radius RMW at each height. I want to avoid loops, so I need to use vector subscripting. How do I do this averaging? <br>
<br>
If RMW was a fixed number like 30, then I’d have simply done a dim_avg_n_Wrap( M (:,:,1:30), 2). <br>
<br>
Can someone help me out with this? <br>
<br>
Thank you, <br>
Prashanth<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>