[Thread Prev][Thread Next][Index]

Re: Daily data to monthly climatology...



Hello Ferreters,
	with the help of ideas from Ansley, Steve and Andrew
off line the users list I could solve the problem of making
monthly mean from daily data exactly as I was looking for.
I thank all of you for suggesting ways of doing that.
	Just I had to define the daily values at 12:00 hrs of every
day to make it work with the aid of /edges qualifier of defined
axis. I think this is a very good convention to adopt
to place the mean values at the mid of the grid (even for the time
axis) which I did miss entirely last time. Now I do:

let month = mod(l-1,12)+1
let add_year = int((l-1)/12)
def \
axis/t="01-jan-1998:12:00":"31-dec-1998:12:00"/npoint=365/units=days \
t_day1
let dy1 = l[gt=t_day1,l=1:365]
let tstep = days1900(1998+add_year,month,1)
define axis/t/units=days/t0=1-jan-1900/edges/name=truemonth \
tstep[l=1:13]
let varmn1 = dy1[gt=truemonth@ave]
let varmns1 = dy1[gt=truemonth@sum]
let varmnn1 = dy1[gt=truemonth@ngd]
list varmn1[l=1:12], varmns1[l=1:12], varmnn1[l=1:12]

and I get correct values and number of points because all the days
of one month fall between the edges of the monthly axis TRUEMONTH.

The second method I tried last time was giving correct means (due 
to the linear nature of the data on a linear axis) but
that was wrong because number of data points under any month was not
correct, which I checked by listing the number of good points with the
@NGD transformation.

The remaining of the problem of shifting daily data already defined in
NetCDF file at 00:00 hrs of the day to 12:00 hrs of that same day
(without any interpolation of regriding) can be done (as pointed out
by Ansley) using @ASN transformation.

cheers,

arindam
------------------------------------------
 ARINDAM CHAKRABORTY
 Centre for Atmospheric & Oceanic Sciences
 Indian Institute of Science
 Bangalore 560 012; INDIA
 Tel: 091-080-3942505, 091-080-3600450
 Fax: 091-080-3600865
__________________________________________

> Arindam Chakraborty wrote:
> 
> > hello Ferreters,
> >         this may be continuation of the discussion about making
> > monthly average from daily data. I've daily data of one year and I'm
> > facing problem in making monthly means from it. To test the monthly
> > mean created I've used a dummy daily variable which takes the value as
> > the Julian day:
> >
> > ! define daily axis and variable
> > def axis/t="01-jan-1998":"31-dec-1998"/npoint=365/units=days t_day
> > def grid/t=t_day g_day
> > let vardy = l[gt=g_day,l=1:365]
> > list vardy[l=1:4]
> >              L[GT=G_DAY,L=1:365]
> >  01-JAN-1998 00 / 1:  1.000
> >  02-JAN-1998 00 / 2:  2.000
> >  03-JAN-1998 00 / 3:  3.000
> >  04-JAN-1998 00 / 4:  4.000
> >
> > Now monthly axis is defined and monthly means were made:
> > let month = mod(l-1,12)+1
> > let add_year = int((l-1)/12)
> > let tstep = days1900(1998+add_year,month,1)
> > define axis/t/units=days/t0=1-jan-1900/edges/name=truemonth
> > tstep[l=1:13]
> > def grid/t=truemonth g_mon
> > let varmn1 = vardy[gt=g_mon@ave]
> > list varmn1
> >              VARDY[GT=G_MON@AVE]
> >  16-JAN-1998 12 /  1:   16.5
> >  15-FEB-1998 00 /  2:   46.0
> >  16-MAR-1998 12 /  3:   75.5
> > ... ...
> >
> > Clearly, both edges are included to make the monthly mean.
> > (JAN mean should be 31*(31+1)/2/31 = 16.0 but it is 32*(32+1)/2/32 =
> > 16.5 and similarly for the other months, except for the 12th).
> > But I want to exclude the 1st data value of the next month while
> > making monthly mean for the present one. I tried like this too:
> >
> > ! define another monthly axis at the middle of every month
> > let ts98 = days1900(1998+add_year,month,1)
> > let te98 = ts98[l=@shf:1] - 1
> > define axis/t/units=days/t0="1-jan-1900:00:00"/name=t_month
> > (ts98[l=1:12]+te98[l=1:12])/2
> > let varmn2 = vardy[gt=t_month@ave]
> > list varmn2
> >              VARDY[GT=T_MONTH@AVE]
> >  16-JAN-1998 00 /  1:   16.0
> >  14-FEB-1998 12 /  2:   45.5
> >  16-MAR-1998 00 /  3:   75.2
> >  15-APR-1998 12 /  4:  105.5
> >  16-MAY-1998 00 /  5:  136.0
> >  15-JUN-1998 12 /  6:  166.5
> >  16-JUL-1998 00 /  7:  197.1
> >  16-AUG-1998 00 /  8:  227.9
> >  15-SEP-1998 12 /  9:  258.5
> >  16-OCT-1998 00 / 10:  289.0
> >  15-NOV-1998 12 / 11:  319.5
> >  16-DEC-1998 00 / 12:  350.0
> >
> > Here all values are correct except MAR (should be 75.0),
> > JUL (should be 197.0) and AUG (should be 228.0). I'm not able
> > to figure out what's happening for these months. Is there any
> > work around? To make the monthly mean I want to consider only those
> > many data points as many days of that month.
> >
> > I'm using Ferret version 5.22 in Linux.
> >
> > thanks,
> >
> > arindam
> > ------------------------------------------
> >  ARINDAM CHAKRABORTY
> >  Centre for Atmospheric & Oceanic Sciences
> >  Indian Institute of Science
> >  Bangalore 560 012; INDIA
> >  Tel: 091-080-3942505, 091-080-3600450
> >  Fax: 091-080-3600865
> > __________________________________________
> >
> > On Fri, 10 Jan 2003, Andrew Wittenberg wrote:
> >
> > > On Fri, 10 Jan 2003, Ansley Manke wrote:
> > > > To make monthly data you would define a monthly time axis for the
> > > > period in question, and regrid your data to it:
> > > >
> > > > DEFINE AXIS/T="1-Jan-1961":"1-jan-1991":1/unit=month t_month
> > > > LET precip_month = precip[GT=t_month]
> > >
> > > Gary & Ansley,
> > >
> > > If your precip is a daily field, you probably want
> > >
> > >    precip[GT=t_month@ave]
> > >
> > > which gives monthly averages.  Otherwise you'll get linear interpolation
> > > (the default regridding).
> > >
> > > Cheers,
> > >
> > > Andrew
> > >
> > > +---------------------------------------+
> > > |  Andrew Wittenberg  |  GFDL/NOAA      |
> > > |  atw@gfdl.noaa.gov  |  Princeton, NJ  |
> > > +---------------------------------------+
> > >
> > >
> 






[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement