# [ncl-talk] summing each of three time-series values

sangeeta maharjan sangeetamaharjan at gmail.com
Mon Nov 2 10:10:45 MST 2015

```hi,

I am planning to use following codes in my scripts to meet my requirements
that i have mentioned in former email.
------------------------------------------------------------------------------------------------------------------------------------------------

W     = wrf_user_getvar(f,"wa", -1)

dim_w=dimsizes(W)

W1 = new((/dim_w(1),dim_w(2),dim_w(3)/),float

W2 = new((/dim_w(1),dim_w(2),dim_w(3)/),float)

W3 = new((/dim_w(1),dim_w(2),dim_w(3)/),float)

MEAN_W = new((/dim_w(0)-4,dim_w(1),dim_w(2),dim_w(3)/),float)

do n=0,dim_w(0)-5

W1(:,:,:)=W(n,:,:,:)
W2(:,:,:)=W(n+1,:,:,:)
W3(:,:,:)=W(n+2,:,:,:)

MEAN_W(n,:,:,:)=(W1+W2+W3)/3

end do

-------------------------------------------------------------------------

I suppose these will be fine.

Regards,

Sangeeta Maharjan.

On Sun, Nov 1, 2015 at 11:13 PM, sangeeta maharjan <
sangeetamaharjan at gmail.com> wrote:

> Dear NCL Users,
>
>
>
> I have variable of 4 dimesion, eg :- W (97(time), 28 (lev), 52 (lat),
> 52(lon)).
>
>
>
> I want to retain sum of  three consecutive values starting from time 0,
> again sum of three consecutive values starting from time 1, again sum of
> three consecutive  values starting from time 2 and so on.  The same process
> is carried  in  every grid point and every vertical levels such that the
> values are stored in new variable, W_sum(93 (time), 28(lev),52 (lat), 52
> (lon)).
>
>
>
> Available functions ,sum (), dim_sum(),dim_sum_n() are not working in my
> case.
>
>
>
> Can you suggest me a suitable method to carry my  operations
>
>
>
> Thanks & Regards.
>
> Sangeeta Mahrjan.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151102/882e12bc/attachment-0001.html
```