# Re: [ferret_users] Monthly mean

Hi
Thanks for your suggestions. I tried to avoid aliasing problem and thus I tried to convert it into daily data first. While using def_monthaxis_days.jnl STANDARD 1993 2016 mytaxis or as suggested by Billy, @ave is not working since the default calendar being Julian
ERROR: regridding:  only @ASN, @LIN, or @NRST regridding between calendar types: JULIAN, GREGORIAN
Any idea?

Reg
Arijeet

On Tue, Feb 28, 2017 at 12:20 PM, William Kessler wrote:
You will lose 15 days at the start and end of the daily time series with the @spz:31 filter, which will probably lose the first and last months.

Plot UF, UFL and UFLSM. Are there missing values at the beginning? (try just plotting 1993)
When something isn't going right, plot your intermediate steps to find out where the problem is.

A better way to define a true monthly time axis and average to it is something like the following:

let start_year=1993
let nyears={however many years you have}
let indices=L[L=1:`12*nyears+1`]         ! can add months if not even years
let month=mod(indices-1,12)+1
let year=start_year+int((indices-1)/12)
define axis/units=days/t0="1-jan-1993:00:00"/edges truemonth=days1900(year,month,day)-days1900(1993,1,1)
let ufmon = uf[gt=truemonth@ave]   ! make a true monthly average from the original 5-day data

Note that the way you have defined axis TDAY, the first time value is on 2-jan-1993. Is that correct?

Billy

> On Feb 27, 2017, at 9:12 PM, Arijeet Dutta <arijeet.uoh@xxxxxxxxx> wrote:
>
> Hi all
> I have data in every 5 days interval, from 1993 to 2016, I want to
> create monthly mean from it. I did the following
>
> define axis/t=1:8766:1/t0="01-jan-1993:00:00"/unit=day tday ! from 5day to daily
> let ufl = uf[gt=tday] ! interpolate (linearly by default)
> let uflsm = uf[l=@spz:31] ! a filter with half-power point of about 37 days
> define axis/t=15-jan-1993:15-dec-2016:1/t0="15-jan-1993"/ unit=month tmon
> let ufmon=uflsm[gt=tmon] ! subsample to monthly
>
> But when I am listing ufmon, I get values from l=4, no values from l=1 to l=3
> Please let me know the mistake
>
> Thanks & reg
> Arijeet