comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: calculating long term statistics on ALBEDO data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: calculating long term statistics on ALBEDO data [message #43298] Wed, 06 April 2005 00:51
Klaus Scipal is currently offline  Klaus Scipal
Messages: 45
Registered: November 1997
Member
The problem with the moment function is that it can only be applied on the
entire array. If you want to apply it to a certain dimension you have to
loop through which slows everything down

Klaus


"Paul Van Delst" <paul.vandelst@noaa.gov> wrote in message
news:d2ur6h$u68$1@news.nems.noaa.gov...
> wita wrote:
>> Hi Klaus,
>>
>> You idea worked, I now have it implemented as follows:
>
> You might also want to look into the MOMENT function (I think that's the
> name). It does the mean, variance, skew and kurtosis in one go.
>
> paulv
>
> --
> Paul van Delst
> CIMSS @ NOAA/NCEP/EMC
>
Re: calculating long term statistics on ALBEDO data [message #43306 is a reply to message #43298] Tue, 05 April 2005 13:07 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
wita wrote:
> Hi Klaus,
>
> You idea worked, I now have it implemented as follows:

You might also want to look into the MOMENT function (I think that's the name). It does
the mean, variance, skew and kurtosis in one go.

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Re: calculating long term statistics on ALBEDO data [message #43308 is a reply to message #43306] Tue, 05 April 2005 09:01 Go to previous message
wita is currently offline  wita
Messages: 43
Registered: January 2005
Member
Hi Klaus,

You idea worked, I now have it implemented as follows:

;Main processing loop
FOR i=0L, num_tiles-1 DO BEGIN
envi_report_stat,base, i, num_tiles
data = envi_get_tile(tile_id1, i)
mask = envi_get_tile(tile_id2, i)
;Only execute at first iterations to get the data dimensions
IF i EQ 0 THEN BEGIN
ds = SIZE(data, /DIMENSIONS)
means = FLTARR(ds[0],36)
stdev = means
decades = LINDGEN(ds[1]) MOD 36
index = WHERE(decades EQ 0)
ENDIF
;Loop over Z direction
FOR k=0, 35 DO BEGIN
tmpindex = index+k
count = TOTAL(FINITE(data[*,tmpindex]),2)
tmpmeans = TOTAL(data[*,tmpindex],2,/NAN)/FLOAT(count)
tmpmeans2d = REBIN(REFORM(tmpmeans, ds[0], 1), ds[0], $
N_ELEMENTS(index))
tmpstdev = SQRT(TOTAL((data[*,tmpindex] - tmpmeans2d)^2, $
2, /NAN)/(count[*]-1))
means[*,k] = tmpmeans
stdev[*,k] = tmpstdev
ENDFOR
WRITEU, unit1, means
WRITEU, unit2, stdev
ENDFOR

It now runs in a fraction of the time compared to the previous version.

Thanks,

Allard
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: dimensional headache
Next Topic: Re: IDLWAVE xemacs Initialization problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:49:04 PDT 2025

Total time taken to generate the page: 0.00527 seconds