[ncl-talk] dim_ave_n function

Dennis Shea shea at ucar.edu
Tue Mar 1 12:11:49 MST 2022


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.
> Many thanks in advance,
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220301/11ce4da0/attachment.html>


More information about the ncl-talk mailing list