**To**:**Steve Cocks <scocks@xxxxxxxxxxxxxxxxxx>****Subject**:**Re: Using @Ave function for irr. data files****From**:**Mick Spillane <spillane@xxxxxxxxxxxxx>**- Date: Wed, 04 Dec 2002 09:17:19 -0800 (PST)
- Cc: ferret_users@xxxxxxxxxxxxxxxxxxx
- In-reply-to: <3DEE2E1B.7DCF541D@ariel.met.tamu.edu>
- Sender: owner-ferret_users@xxxxxxxxxxxxxxxxxxx

Hi Steve, This sounds like an issue that came up before. For evenly spaced data @ave is just like a simple average - add the values and divide by the number of points. But for unevenly spaced points, what one wants is the weighted average, the weighting being the length of axis to which each value applies. In the absence of other information ferret assigns the boundaries/edges of the boxes to the midpoints between the data locations. If one wants the simple average in the case of unevenly spaced data the ratio v[l=@sum]/v[l=@ngd] will supply it. Heres a demo let v=tsequence({1,4,6,5}) ! evenly spaced list v[l=@ave] ! gives 4.000 as expected ! now locate those same values on an uneven time axis let tax=tsequence({2,5,8,10}) def axis/t/from_data/name=taxis tax def grid/t=taxis grd let vt=v[g=grd,gt=@asn] list vt[l=@ave] ! gives 3.810 as expected since show grid/t grd ! shows the box widths are ! 3,3,2.5,2 respectively. list vt[l=@sum]/vt[l=@ngd] ! still gives 4.000 Mick |____spillane@pmel.noaa.gov____| |__Room 2070 Bldg#3 NOAA/PMEL__| |____Phone_:_(206)526-6780_____|

**References**:**Using @Ave function for irr. data files***From:*Steve Cocks

- Previous by thread:
**Using @Ave function for irr. data files** - Next by thread:
**axis value in DODS served netCDF files**

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement