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

Dennis Shea shea at ucar.edu
Wed Feb 6 08:52:43 MST 2019

```Adam is correct. There is no Day/Hour function distributed with NCL.

However, I do have a function "*clmDayHourTLL*" that computes the Day-Hour
climatologies [attached with a test example]. There is no online
documentation. See code comments.  There is no "*clmDayHourAnomTLL*"
function. You can use the "*clmDayAnomTLL*" as a guide on how to create the
anomaly function.

This just never made it into the NCL distribution.

Good Luck

On Tue, Feb 5, 2019 at 1:46 PM Adam Phillips <asphilli at ucar.edu> wrote:

> 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
>>
>
>
> --
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
> _______________________________________________
> 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/20190206/095ab4e4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clmDayHour.ncl
Type: application/octet-stream
Size: 12073 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190206/095ab4e4/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst.clmDayHourTLL.ncl
Type: application/octet-stream
Size: 1898 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190206/095ab4e4/attachment-0001.obj>
```