[ncl-talk] runave and missing values

Dennis Shea shea at ucar.edu
Thu Feb 5 15:33:57 MST 2015


Well, of course a function (possibly even 'runave', 'runave_n') could be
modified to do this,  However, that could cause some issues.  Let
'nave=51'  ... All sequences with 51 consecutive values would yield a
result that had consistent filter characteristics. Lets say that there is a
sequence with only one value ... Would you want that to be returned ...
mixed with all other 'smoothed' values?

If the number of missing points is 'small' I would suggest that
         https://www.ncl.ucar.edu/Document/Functions/Built-in/linmsg_n.shtml
be used to preprocess the series prior to performing the runave_n script.
Note that this has an option that will only operate a  user specified max
length of missing values.

D


On Thu, Feb 5, 2015 at 1:32 PM, Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Carl/Maria,
> This a not a terribly clean solution, but when I need to do that type of
> averaging I use the dim_avg* functions which happily ignore the data with
> _FillValue's and will average over whatever data is there. The negative to
> doing this is that you need to call dim_avg multiple times within a do loop:
>
> ssttemp = sst_t
> ssttemp = ssttemp at _FillValue
> do qq = 1,dimsizes(sst_t&time)-3     ; calculate 4-mo running average
>      ssttemp(:,:,qq) = dim_avg(sst_t(:,:,qq-1:qq+2))  ; missing data
> allowed
> end do
> delete(sst_t)
>
> All that being said, I agree that a version of runave that allows
> _FillValue data would be useful.. Adam
>
>
>
> On Thu, Feb 5, 2015 at 1:20 PM, Maria Gehne - NOAA Affiliate <
> maria.gehne at noaa.gov> wrote:
>
>> Hi Carl,
>>
>> I don't have a solution for you, but I would definitely be interested in
>> a function that does that.
>>
>> Maria
>>
>> On Thu, Feb 5, 2015 at 10:49 AM, Carl Schreck <cjschrec at ncsu.edu> wrote:
>>
>>> 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
>>> <http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
>>> monitor.cicsnc.org/mjo
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Division, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150205/759b3227/attachment.html 


More information about the ncl-talk mailing list