# Re: calculating daily/monthly average of the time series

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 12 2011 - 08:30:30 MDT

Without knowing the details of 'time' or what is desired
for the final product .... a conceptual approach

; daily

ntim = dimsizes(time)
ymd = cd_calendar(time, -2) ; yyyymmdd
nday =
xday = new (nday, typeof(x), getFillValue(x))

do yr=yrStrt,yrLast
do mo=1,12
kday = days_in_month(yr,mo)
do dy=1,kday
YMD = yr*10000 + mo*100 + dy
idy = ind(YMD.eq.ymd)
if (.not.ismissing(idy(0))) then
xday(n) = avg(x(idy)) ; compute 'n'
end if
delete([/ YMD, idy /]) ; may change next iteration
end do
end do
end do

Still, if you have (say) only one value, for one day and 100 values for
a different day, the numbers are naot of the same 'statistical integrity'

D

On 8/12/11 6:46 AM, Ufuk Utku Turuncoglu (BE) wrote:
> Hi,
>
> I just wonder that is there any function or code that can be used to
> calculate daily or monthly average of the time series? For example, the
> actual data is one dimensional array that has time coordinate like,
>
> Variable: data
> Type: double
> Total Size: 586600 bytes
> 73325 values
> Number of Dimensions: 1
> Dimensions and sizes: [time | 73325]
> Coordinates:
> time: [15652.70833333333..17495.4375]
> Number Of Attributes: 1
> _FillValue : 9.969209968386869e+36
>
> and time dimension has also units. Also note that the data is not evenly
> distributed in time dimension and in this case i can not use running
> average function. If NCL has no any function to do that, i think that it
> will be useful to have it. Anyway, any suggestion can be helpful.
>
> Regards,
>
> --ufuk
>
>
>
> _______________________________________________
> 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
Received on Fri Aug 12 08:30:36 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 12 2011 - 11:48:30 MDT