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

Home » Public Forums » archive » Re: Calculate the mean of many images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Calculate the mean of many images [message #63639 is a reply to message #63635] Sun, 16 November 2008 16:35 Go to previous messageGo to previous message
Wasit.Weather is currently offline  Wasit.Weather
Messages: 62
Registered: February 2008
Member
On Nov 16, 3:04 pm, David Fanning <n...@dfanning.com> wrote:
> Bulrush writes:
>> Thank you. I just run the code, but it always reporting syntax error
>> for sum(wh) +=3D img(wh), for the brackets.
>
> I think that is a hold-over from Craig's days as the King
> of IDL 4.0. ;-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Seems like I got lost between the codes. the mean I got with avg[wh]
is all zero. Here is my code. Thanks for your help.

FOR K = 0, images-1 DO BEGIN
ENVI_OPEN_FILE, files[K], r_fid=files_fid
ENVI_FILE_QUERY, files_fid, ......
pos = lindgen(nb)
; get the data
Data = ENVI_GET_DATA(fid=files_fid, dims=dims, pos=pos[0])
QA = ENVI_GET_DATA(fid=files_fid, dims=dims, pos=pos[1])
mask = (QA EQ 0.00) AND (finite(Data) EQ 1) OR (QA EQ 1.00) AND
(finite(Data) EQ 1)

; Sum Valid Pixels
npix += mask
wh = where(mask, ct)
if ct GT 0 then sum[wh] += Data[wh]
EndFor

; Positions where there are good pixels
qa_avg = (npix GT 0)
wh = where(qa_avg EQ 1)

; Compute average for valid pixels
avg = sum*0
avg[wh] = sum[wh] / npix[wh]

I am also wondering what does += means?

Thank you!!!1
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL and sqlite
Next Topic: A Simple IDL Manifesto

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

Current Time: Fri Oct 10 00:13:28 PDT 2025

Total time taken to generate the page: 0.63850 seconds