./
avg_nonzero.pro
topavg_nonzero
result = avg_nonzero(data [, dimension] [, NAN=NAN] [, DOUBLE=DOUBLE])
compute a mean without having to use moment, and does not average in zeros
Return value
the mean of the array
Parameters
- data in required
an array that contains the data you with to average
- dimension in optional
tells which dimension to total over, see help for total
Keywords
- NAN in optional
pass nan to total()
- DOUBLE in optional
perform the avergaing in double, pased to total()
Examples
a = [ [1.00000,1.00000,2.00000,3.00000], $
[4.00000,0.000000,6.00000,7.00000], $
[8.00000,9.00000,0.000000,11.0000], $
[12.0000,13.0000,14.0000,0.000000] ]
IDL> print, avg_nonzero(a)
7.00000
IDL> print, avg_nonzero(a,1)
1.75000 5.66667 9.33333 13.0000
IDL> print, avg_nonzero(a,2)
6.25000 7.66667 7.33333 7.00000
Author information
- History:
3/28/2003 Brian Larsen - created 7/01/2007 Brian Larsen - fixed up 7/24/2007 Brian Larsen - rewritten much smarter from http://groups.google.com/group/comp.lang.idl-pvwave/browse_frm/thread/baf04086fc71d348/ee7ef51147d32797#
Statistics
| Lines: | 15 |
| McCabe complexity: |
File attributes
| Modifcation date: | Tue Sep 9 14:11:08 2008 |
| Lines: | 75 |
![[attach.png]](idldoc-resources/attach.png)