[Thread Prev][Thread Next][Index]
Re: How to calculate the annual average
- To: Ming Yang <myang@xxxxxxxxxxxxx>
- Subject: Re: How to calculate the annual average
- From: Ansley Manke <ansley.b.manke@xxxxxxxx>
- Date: Fri, 01 Apr 2005 09:49:31 -0800
- Cc: Ferret Users mailing list <oar.pmel.ferret_users@xxxxxxxx>
- In-reply-to: <Pine.GSO.4.44+UNC.0504010944560.17404-100000@dali.gphys.unc.edu>
- References: <Pine.GSO.4.44+UNC.0504010944560.17404-100000@dali.gphys.unc.edu>
- Sender: owner-ferret_users@xxxxxxxxxxxxx
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
Hi Ming,
When the time series is done in terms of index value, you caon compute
the annual averages like this:
define axis/t=6:4800:12 yearaxis
let sst_year = sst[gt=yearaxis@ave]
The output axis is in the same units (which is just the index value, but
you can think of it as months). I start with 6 so that the averages are
taken over the first 12 points, then 13 through 24, and so on. To test
what this is doing, here is an example where I make up some data, where
the variable has the value of the index.
yes? def axis/t=1:4800:1 tmonth
yes? def axis/t=6:4800:12 tyear
yes? let tt = t[gt=tmonth]
yes? let ttyear = tt[gt=tyear@ave]
yes? list/l=1:5 ttyear
VARIABLE : TT[GT=TYEAR@AVE]
SUBSET : 5 points (T)
6 / 1: 6.26
18 / 2: 18.00
30 / 3: 30.00
42 / 4: 42.00
54 / 5: 54.00
The first value is different from the expected 6 because the first
averaging interval in T (t=1 to 12) is taken from the start of the time
axis, 0.5, to 12, so the weighting factor is 11.5. The start of the
axis is t=0.5 not 0. The second interval (t=12 to 24) takes the average
from 12 to 24, so the weighting is 12.
We can also see this if we compute unweighted average computed by taking
the transformation @SUM and dividing by the number of good data, @NGD:
yes? let ttsum = tt[gt=tyear@sum]
yes? let ttcount = tt[gt=tyear@ngd]
yes? let ttyear = ttsum/ttcount
yes? list/l=1:5 ttsum, ttcount, ttyear
T: 0 to 60
Column 1: TTSUM is TT[GT=TYEAR@SUM]
Column 2: TTCOUNT is TT[GT=TYEAR@NGD]
Column 3: TTYEAR is TTSUM/TTCOUNT
TTSUM TTCOUNT TTYEAR
6 / 1: 72.0 11.50 6.26
18 / 2: 216.0 12.00 18.00
30 / 3: 360.0 12.00 30.00
42 / 4: 504.0 12.00 42.00
54 / 5: 648.0 12.00 54.00
Ming Yang wrote:
Hi, Ansley
After I reading the FAQ, I still cannot figure out how to compute the
annual average. It is probably because my data set is different from the
example listed in the FAQ. Here is the basical information of my dataset
yes? use cresum001710.sst.nc
yes? show data
currently SET data sets:
1> ./cresum001710.sst.nc (default)
name title I J K L
SST Sea surface temperature 1:144 1:72 ... 1:4800
I think the difference is that in my dataset the grid is defines as
IJKL instead of XYZT. And also the L axis is not based on any calendars.
Basically what I want to do is to calculate the average values for every
12 Ls so that to the transformed data has 400 points in L axis. Do you
know what is the best way for me to do so? Thank you for your help.
Ming
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement