# [ncl-talk] four month ruining average

Tue May 23 13:38:34 MDT 2017

```Hi Yohanan,
Calculating a 4-month running average is similar to calculating a 3-month
running average. As the calculation is done over an even number of months,
the 4-timestep average (over slots 1,2,3 and 4) will be placed in the 2nd
slot. You can test this out interactively by typing the following:
ncl
a = (/4,1.2,7.4,8.0,-0.1/)
temp = runave(a,4,0)
print(temp)
(0) 9.96921e+36
(1) 5.15
(2) 4.125
(3) 9.96921e+36
(4) 9.96921e+36

You can see the average of the first four numbers is put into the (1) slot.

For a case involving a 3 dimensional array with metadata you can use
runave_n_Wrap:
; arr = array dimensioned time x lat x lon
temp = runave_n_Wrap(arr,4,0,0)
arr_fmam = temp(2::12,:,:)

Make sure you check the input and output so you know the coding is doing
what you think it is doing.

Hope that helps. If you have any further questions please post back to the
ncl-talk email list.

On Sat, May 20, 2017 at 5:39 AM, yohanan sweet <marsilas23 at gmail.com> wrote:

> Heloo ncl tailk
>
> I want to plot correlation between rainfall and Nino 3.4 index,with the
> ruining average of 4 month i can run average for 3 month how i can make 4
> month average for FMAM. can anyone help me please??
>
> Thank you
> Yohanan F
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

--