array averaging [message #67681] |
Thu, 13 August 2009 01:49 |
Lasse Clausen
Messages: 22 Registered: August 2001
|
Junior Member |
|
|
Hi there,
I have particle distribution functions measured by a spacecraft in a
4D array. The dimensions are energy, azimuth, polar angle and time.
This array contains NaNs. I would like to average over, say, all
azimuthal angles such that I get a 3D array. The totalling up is
easily done like so
PSD FLOAT = Array[31, 16, 8, 2693]
tot_azi_psd = TOTAL(psd, 2, /NAN)
However, I need to divide this number by the number of non-NaN values
in each, well, column, row, whatever you like to call it, of azimuths.
I struggle to find an easy way to determine this without looping
through all dimensions. Obviously, I can find the indices of the NaN
using WHERE, but so far that doesn't help me.
Any ideas?
Cheers
Lasse Clausen
PS: The MEAN function has a /NAN switch, but unfortunately no
dimension keyword.
|
|
|