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

Home » Public Forums » archive » Re: Partial summation of a data set!
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: Partial summation of a data set! [message #51369 is a reply to message #51366] Thu, 16 November 2006 03:24 Go to previous message
enod is currently offline  enod
Messages: 41
Registered: November 2004
Member
The problem may lies in this:
total(values[chk])

Try:
total(values[*,chk])



Regards,
Tian


DirtyHarry wrote:
> One more time, thanks for your invaluable suggestions for my previous
> post. I have another data file with 50 columns * 8767 rows. This is a
> part of it.
> Day month year data1 data2 data3 ... data47
> 1 1 1981 ...
> .
> .
> .
> 12 30 2005
>
> What I am trying to do now is to add up the data in 28 to 35 columns in
> each year. So what I have done so far is...
>
> pro calout
>
> ;CONTROL VARIABLES
> rootpath="D:\IDL_Documents\Temp\" ;working directory
> ncol= 50
> nrow= 8767
> h=''
> data=fltarr(ncol,nrow-1)
>
> close, 1
> openr, 1, rootpath + 'f1_grow_stratum.daily' ; This is my data file.
> readf, 1, h
> readf, 1, data
> close, 1
>
> years=reform(data[2,*]) ;3rd column is year.
> values=reform(data[28:35,*])
>
> for i=1981, 2005 do begin
> chk=where(years eq i, n_chk)
> if n_chk eq 0 then continue
> print, 'Year :', i, ' -> Total = ', total(values[chk])
> endfor
> end
> --------------------------
> It seemed that there was no problem. No stop, no errors. However,
> results were totally different form what I expected. Any suggestions or
> comments? Thanks, in advance!!!
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Duplicate heap variables recursively
Next Topic: Generating errors

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

Current Time: Thu Oct 09 07:18:53 PDT 2025

Total time taken to generate the page: 0.00309 seconds