# Re: Daily averages from hourly values (I=lo:hi:delta@AVE explained)

```Hi Jeremy,

I think I can best answer this by illuminating the machinery behind the
scenes.

The notation
ppt[i=1:10:2]
creates a new, regularly-spaced axis with points located where i=1, i=3,
etc. were located in the original axis. Ferret's default algorithm in
computing the values along the new axis is linear interpolation, which
leads to the copying the identical source axis values at i=1, i=3, etc.

When you, instead specify regridding with @AVE as in
ppt[i=1:10:2@ave]
you are requesting a weighted average of the source data into the
destination axis grid cells. As the attached figure shows, the result is
a kind of 1-2-1 filtering of the source data into the destination axis
cells.

If this is not the desired behavior, then use either
ppt[X=lo:hi:del]
or
DEFINE AXIS/ ... my_intervals  ; ppt[gx=my_intervals@ave]
to get more precise control.

Does the behavior you observed make sense in this context?

- steve

P.S. Note that the behavior of Ferret V5.0 in producing missing values
at the endpoints when regridding with @AVE has been changed in 5.1,
which is less strict about gaps in the source axis data.

Here are the commands that generated the attached figure:

yes? let ii = i[i=1:9]
yes? let ii2d = ii + 0*j[j=1:2]     ! 2-dimensional in
structure, only

yes? set view upper
yes? set view lower

==========================================================

Jeremy S Pal wrote:

>   Hi -
>
> I am trying to plot up daily averages of hourly data.  When I run
> the following command, I do not seem to get an average for the
> first day:
> yes?  list ppt[l=1:744:24@ave]
>  01-JUL-1993 00 /  1:   ....
>  02-JUL-1993 00 /  2:  10.25
>  03-JUL-1993 00 /  3:   4.13
> ...
>  31-JUL-1993 00 / 31:   0.03
>
> Here are the results some commands that may help with this
> problem:
> yes? list ppt[l=1]
>           0.1155
> yes? list ppt[l=2]
>           2.150
> yes? list ppt[l=1:1:1@ave]
>           0.1155
> yes? list ppt[l=1:2:2@ave]
>         ....
> yes? list ppt[l=2:2:1@ave]
>           2.150
> yes? list ppt[l=2:2:2@ave]
>           1.455
> yes? list (0.5*ppt[l=1]+ppt[l=2]+0.5*ppt[l=3])/2
>           1.455
> So, it seems that maybe ferret is weighting the outer times by
> 50%.  In my case, is ferret asking for ppt at l=0 (l=1/2)?  If
> so, is there some way to tell ferret not to include l=0?
>
> Any help is greatly appeciated.
>
>   Thank you,
>
>   - Jeremy

--
Steve Hankin
NOAA/PMEL, 7600 Sand Point Way NE, Seattle, WA 98115-0070
ph. (206) 526-6080 -- FAX (206) 526-6744

```