# [ncl-talk] dim_ave_n function

Setareh Rahimi setareh.rahimi at gmail.com
Tue Mar 1 13:17:51 MST 2022

```Dear Dennis,
Thanks for your help. However, I can not undrestand:  *wgt =
(/50,50,100,100,100,50,25,10/).*
Why did you choose these values, please?
Best wishes,

On Tue, Mar 1, 2022 at 10:42 PM Dennis Shea <shea at ucar.edu> wrote:

> You want to use a weighted average. The weights are the layer thicknesses.
>
> see =:   *dim_avg_wgt_n_Wrap*
> <https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_wgt_n_Wrap.shtml>
>
> See Example 2 at: *dim_avg_wgt_n*
> <https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg_wgt_n.shtml>
>
> X (time, level, lat, lon).
>
> wgt  = (/50,50,100,100,100,50,25,10/)  ; same size as dimension "lev"   0:7
>
>     Tavg = *dim_avg_wgt_n_Wrap*( T(:,0:7,:,:), wgt, 0, 1 )
>
>
> On Tue, Mar 1, 2022 at 11:29 AM Setareh Rahimi via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear All,
>> I have a variable say X (time, level, lat, lon). I need to compute
>> average over level dimension, which includes 18 layers. But I just want to
>> average over layers from 0 to 7. So how can I modify :
>> X _ave = dim_avg_n( X, 1)
>>
>> to get the desired result, please.
>> Best wishes,
>>
>> --
>> S.Rahimi
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

--
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220301/db575a78/attachment.html>
```