Re: Partial summation of a data set! [message #51369 is a reply to message #51366] |
Thu, 16 November 2006 03:24  |
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!!!
|
|
|