[ncl-talk] removing ensemble mean from original data

Rashed Mahmood rashidcomsis at gmail.com
Fri Jun 12 05:48:59 MDT 2020


If you just want to remove ensemble mean then you could do the following:

x_new      = x
ens_mean = dim_avg_n_Wrap(x,1)
do n=0,nens-1
   x_new(:,n,:,:) = x(:,n,:,:) - ens_mean
end do

However, please make sure that this is what you want!, it is up to you to
decide and know what you are trying to accomplish here. Your variable names
suggest that there could be some confusion...

Cheers,
Rashed





On Fri, Jun 12, 2020 at 12:50 PM Sri nandini via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hello dear ncl-users,
>
> I want to know the best way to remove the ensemble mean from the
> corresponding time of each ensemble member. Can someone tell me if the
> following code is correct? i do not get any error but i wanted to be
> sure of the method.
>
> Thanx in advance
>
> Sri
>
> ;==================================================================
> ;  Remove the ensemble mean from each ensemble member
> ;==================================================================
>     dimx = dimsizes(x)
>     ntim = dimx(0)          ; 240
>     nens = dimx(1)          ; 100
>     nlat = dimx(2)          ; 45
>     mlon = dimx(3)          ; 90
>
>     nmos = 12
>     nyrs = ntim/nmos         ; 21
>
>     printVarSummary(x)       ;[time | 240] x [ens | 100] x [lat | 45] x
> [lon | 90]
>     ens_mean=dim_avg_n_Wrap(x,1)
>     printVarSummary(ens_mean);[time | 240]  x [lat | 45] x [lon | 90]
>
>      detrended_x = x
>      do nt=0,ntim-1
>        nmo = nt%12
>       do ne=0,nens-1
>          detrended_x(nt,ne,:,:) = (/ x(nt,ne,:,:) - ens_mean(nmo,:,:) /) ;
> detrended array
>       end do
>     end do
>     detrended_x at long_name = “Ensemble mean removed”
>
>     printVarSummary(detrended_x)
>    [time | 240] x [ens | 100] x [lat | 45] x [lon | 90]
>
> _______________________________________________
> 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/20200612/9d159533/attachment.html>


More information about the ncl-talk mailing list