[ncl-talk] Running average

Soma Roy somaroy892 at gmail.com
Tue Dec 4 04:13:05 MST 2018


*Hello,*
The below process just reduced 4 days from time steps.
*cdo **-runavg*,5  infile  outfile

I used the above procedure over an one year file (365 days). After
operation its dimension becomes as follows;
Lat =129, Lon =135 , time=361

Whereas,
 cdo -timselmean,5 infile outfile
Give the correct result in terms of time dimension which one is expected.
Lat =129, Lon=135, time=73

Soma


On Tue, Dec 4, 2018, 10:03 Soma Roy <somaroy892 at gmail.com wrote:

> Thank you very much.
>
> Soma
>
> On Tue, Dec 4, 2018, 04:05 Dennis Shea <shea at ucar.edu wrote:
>
>> Better:
>>
>> navg        = 5
>> xRunAvg = ...
>> nStrt        = navg/2
>> xBlock_5 = xRunAvg(nStrt::navg,:,:)
>>
>> navg        = 7
>> xRunAvg = ...
>> nStrt        = navg/2
>> xBlock_7 = xRunAvg(nStrt::navg,:,:)
>>
>> On Mon, Dec 3, 2018 at 3:19 PM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> Hi Soma,
>>>
>>> What you want are *block* 5-day and 7-day averages. EG: *"73* times for
>>> a *365* day series."
>>> It is your responsibility to be clear on your objective.
>>> Otherwise, people spend their valuable time trying to figure out what
>>> you want.
>>>
>>> x(time, lat, lon)     .... (ntim,nlat,mlon)
>>>      0      1    2     <=== dimension numbers [ Please read NCL
>>> documentation]
>>>
>>> Two approaches:
>>>
>>> [1]
>>>
>>>    endopt = ... ; -1, 0, 1   PLEASE read the documentation
>>>    ndim_time = 0
>>>
>>>    navg = 5
>>>    xRunAvg = *runave_n_Wrap
>>> <http://www.ncl.ucar.edu/Document/Functions/Contributed/runave_n_Wrap.shtml>(*x,
>>> navg, endopt, ndim_time)  ; classic running average (ntim,nlat,mlon)
>>>    xBlock_5 = xRunAvg(::navg,:,:)
>>>    printVarSummary(xBlock_5)
>>>
>>>    navg = 7
>>>    xRunAvg = *runave_n_Wrap
>>> <http://www.ncl.ucar.edu/Document/Functions/Contributed/runave_n_Wrap.shtml>(*x,
>>> navg, endopt, ndim_time)  ; classic running average (ntim,nlat,mlon)
>>>    xBlock_7 = xRunAvg(::navg,:,:)
>>>    printVarSummary(xBlock_7)
>>>
>>> [2]
>>>
>>> *http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_segment_values.shtml*
>>> <http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_segment_values.shtml>
>>>
>>> This requires that 'time' have CF conforming units. I suggest you use
>>> [1].
>>>
>>> On Mon, Dec 3, 2018 at 2:27 PM Soma Roy <somaroy892 at gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> I used the example 2 from the below link;
>>>> https://www.ncl.ucar.edu/Document/Functions/Built-in/runave_n.shtml
>>>>
>>>> But there is no change in output time dimension.
>>>> I used 365 days data over nlat x nlon as input.
>>>>
>>>> I set nave=5 with expectation to get nlat x nlon for 73 times in output.
>>>>
>>>> But there is no change in output dimensions. Then how to extract 5 days
>>>> running avg. over 365 days dataset?
>>>>
>>>> Kindly inform me.
>>>>
>>>> Thanking you,
>>>> Soma
>>>>
>>>> On Mon, Dec 3, 2018, 21:10 Soma Roy <somaroy892 at gmail.com wrote:
>>>>
>>>>> Thanks for the hints
>>>>>
>>>>> Soma
>>>>>
>>>>> On Mon, Dec 3, 2018, 19:21 Appo derbetini <appopson4 at gmail.com wrote:
>>>>>
>>>>>> Hi,
>>>>>> I think that you easily do it with
>>>>>> *https://www.ncl.ucar.edu/Document/Functions/Built-in/runave_n.shtml
>>>>>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/runave_n.shtml>*
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Le lun. 3 déc. 2018 à 10:54, Soma Roy <somaroy892 at gmail.com> a
>>>>>> écrit :
>>>>>>
>>>>>>> Thank you.
>>>>>>> Efficient way to do.
>>>>>>>
>>>>>>> But I would like to know also the steps for this by using ncl.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Soma
>>>>>>>
>>>>>>> On Mon, Dec 3, 2018, 15:14 Oluwaseun Ilori <wilseun at gmail.com wrote:
>>>>>>>
>>>>>>>> Cdo will do it easily and better
>>>>>>>>
>>>>>>>> cdo -timselmean,5 infile outfile
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Dec 3, 2018, 10:36 AM Soma Roy <somaroy892 at gmail.com wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I am using daily gridded rainfall datasets.
>>>>>>>>> I want to compute 5 days and 7 days running avg. of rainfall from
>>>>>>>>> the datasets over each grid points.
>>>>>>>>>
>>>>>>>>> Structure of the input file is like below;
>>>>>>>>>
>>>>>>>>> Rain (730, 129, 135)  ; (time (365*2), lat, lon)
>>>>>>>>>
>>>>>>>>> Please kindly inform me which function should I use in this case.
>>>>>>>>>
>>>>>>>>> Thanking you,
>>>>>>>>> Soma
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> ncl-talk mailing list
>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>> ncl-talk mailing list
>>>>>>> ncl-talk at ucar.edu
>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>
>>>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> 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/20181204/38147118/attachment.html>


More information about the ncl-talk mailing list