# [ncl-talk] Best-way to calculate 6-hourly anomalies

Tue Feb 5 13:45:33 MST 2019

```Hi Lyndz,
No, a function does not exist, at least one is not in contributed.ncl. You
can always create one and share it with the community.

If your data has 4x values for 365 days for each year from 1979-2017 then
the calculation is relatively straight forward. If you have leap years,
duplicate or missing days, then the function would potentially be tougher
as the time coordinate variable would need to be checked. In the simpler
former case, something like this would calculate the 6-hourly means:

; Untested! Check that the following works as you would expect it.
syear = 1979
eyear = 2017
nyr = eyear-syear+1
ntimes_oneyr = 365*4
climo = arr(:ntimes_oneyr-1,:,:)   ; arr = data array running from
1979010100->2017123118
climo = climo at _FillValue  ; climo = array containing the climatology
do gg = 0,ntimes_oneyr-1   ; calculate the climatology
climo(gg,:,:) = (/ dim_avg_n(arr(gg::ntimes_oneyr,:,:),0) /)
end do

do gg = 0,dimsizes(arr&time),ntimes_oneyr   ; remove the climatology from
every year
arr(gg:gg+ntimes_oneyr-1,:,:) = (/ arr(gg:gg+ntimes_oneyr-1,:,:) -
climo /)
end do

Hope that helps!

On Tue, Feb 5, 2019 at 6:16 AM Lyndz <olagueralyndonmark429 at gmail.com>
wrote:

> Dear NCL-experts,
>
> I have a 6-hourly data set of *u-*wind from 1979-2017.
>
> I'm wondering if there is an undocumented function in NCL for calculating
> 6-hourly anomalies similar to calcDayAnomTLL:
>
> https://www.ncl.ucar.edu/Document/Functions/Contributed/calcDayAnomTLL.shtml
>
> Will this function work for 6-hourly data sets?
> I'll appreciate any suggestions on how to do this efficiently using NCL.
>
> Sincerely,
>
> Lyndz
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

--