# [ncl-talk] runave and missing values

Carl Schreck cjschrec at ncsu.edu
Thu Feb 5 10:49:58 MST 2015

```Is there a version of runave that will average all nonmissing values? In
the current version, if there is even one missing value within a window,
the average is set to missing.

For example:
ncl 0> x = ispan( 1, 15, 1 )
ncl 1> x at _FillValue = -99
ncl 2> x(8) = x at _FillValue
ncl 3> y = runave( x, 5, 1 )
ncl 4> print( x + " " + y )
(0) 1 2.2
(1) 2 2.4
(2) 3 3
(3) 4 4
(4) 5 5
(5) 6 6
(6) 7 -99
(7) 8 -99
(8) -99 -99
(9) 10 -99
(10) 11 -99
(11) 12 12
(12) 13 13
(13) 14 13.6
(14) 15 13.8

What I'd like to have happen is something like:
(0) 1 2.2
(1) 2 2.4
(2) 3 3
(3) 4 4
(4) 5 5
(5) 6 6
(6) 7 6.5   < = = ( 5 + 6 + 7 + 8 ) / 4
(7) 8 7.75   < = = ( 6 + 7 + 8 + 10 ) / 4
(8) -99 9   < = = ( 7 + 8 + 10 + 11 ) / 4
(9) 10 10.25   < = = ( 8 + 10 + 11 + 12 ) / 4
(10) 11 11.5   < = = ( 10 + 11 + 12 + 13 ) / 4
(11) 12 12
(12) 13 13
(13) 14 13.6
(14) 15 13.8

--

<http://www.cicsnc.org/>
<http://www.researcherid.com/rid/B-8711-2011>
* Cyclone <http://www.cyclonecenter.org/>*Center.org
<http://www.cyclonecenter.org/>  *Carl J. Schreck III, PhD*
*Research Associate*
Cooperative Institute for Climate and Satellites NC <http://www.cicsnc.org/>

North Carolina State University <http://ncsu.edu/>
NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
151 Patton Ave, Asheville, NC 28801
e: cjschrec at ncsu.edu
o: +1 828 257 3140
Publications