Calculate an unweighted running average. Missing values are allowed.
Note: This function is only available in version 4.1.1 of NCL. If your site is licensed for version 4.1, then you can get version 4.1.1 for free. To get version 4.1.1 of NCAR Graphics software, please contact your site representative. If you don't know who your site representative is, then send email to ncarginf@ucar.edu or call (303) 497-1201.
function runave( x : float, nave : float, kopt : integer )
In the following, N=last point in the series:
kopt < 0 : utilize cyclic conditions e.g., nave=3 x(0) = (x(N) +x(0)+x(1))/nave x(N) = (x(N-1)+x(N)+x(0))/nave e.g., nave=4 at n=1 and n=N x(0) = (x(N-1)+x(N) +x(0)+x(1))/nave x(N) = (x(N-2)+x(N-1)+x(N)+x(0))/nave kopt = 0 : set unsmoothed beginning and end pts to x@_FillValue [most common] e.g., nave=3 , x(0) = (x@_FillValue and x(N) = (x@_FillValue , x(1) = (x(0)+x(1)+x(2))/nave e.g., nave=4 , x(0),x(1),x(N-1) and x(N) = (x@_FillValue , x(2) = (x(0)+x(1)+x(2)+x(3))/nave kopt > 0 : utilize reflective (symmetric) conditions e.g., nave=3 x(0) = (x(1) +x(0)+x(1))/nave x(N) = (x(N-1)+x(N)+x(N-1))/nave e.g., nave=4 x(0) = (x(2) +x(1) +x(0)+x(1))/nave x(N) = (x(N-2)+x(N-1)+x(N)+x(N-1))/nave
F(i) = SUM{UF(i-(nave/2)+j-1)}/nave from j=0,nave-1where F is the filtered field, UF is the unfiltered field, and nave is the number of elements in the running average.
If the number of weights is even, the filter's center falls between series elements; in this case, the center is shifted one-half of a time increment towards the latter element.
x = runave (x,3,0)
nave = 31 kopt = 0 y = runave (x(lat|:,lon|:,time|:), nave, kopt)y will be a 3-dimensional array of length nlat x mlon x time.
nave = 5 kopt = -1 x = runave (x,nave, kopt) ; return the series in the original array
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?