|
Re: From a novice in IDL [message #31857 is a reply to message #31843] |
Wed, 21 August 2002 06:28  |
Robert Stockwell
Messages: 74 Registered: October 2001
|
Member |
|
|
Pranab J. Baruah wrote:
> Hi,
>
> I am new to IDl and new to to this great group. Would be obliged if
> anybody can help me with my programming problem.
>
> My program tries to do some simple data manipulation. There are say 3
> binary data files [FILE1, FILE2, FILE3] and I have to put them into
> one big file where, the big file[FILE_NEW] contains 3 columns[for
> three binary files] and the rows of these files come under the columns
> of FILE_NEW [after transposed].
>
> Now, when I try to run the program, as shown below, it get stuck with
> the listed errors below when i=46, i.e. when (i*720-1)=33119 in FILE1
> of first line within the loop. ### The program worked and gave
> expected results when the data dimension was less, say for binary
> files of [115][100] ###
>
> Just can't guess why it is so. Please help !!
> -----------------The Program :start------------------
> pro data_stacker_big1
>
> FILE1 = read_binary('feb_2001_geo5.bsq', DATA_DIMS=[720,356])
> FILE2 = read_binary('mar_2001_geo5.bsq', DATA_DIMS=[720,356])
> FILE3 = read_binary('apr_2001_geo5.bsq', DATA_DIMS=[720,356])
>
> ;Below 256320 = 720*356
> FILE_NEW=bytarr(3,256320)
>
> for i=1,356 do begin
>
> FILE_NEW[0,((i-1)*720):(i*720-1)]=FILE1[((i-1)*720):(i*720-1 )]
> FILE_NEW[1,((i-1)*720):(i*720-1)]=FILE2[((i-1)*720):(i*720-1 )]
> FILE_NEW[2,((i-1)*720):(i*720-1)]=FILE3[((i-1)*720):(i*720-1 )]
>
> endfor
>
> openw, lun, 'output.dat', /get_lun
> printf, lun, FILE_NEW
> free_lun, lun
>
> end
> -----------------The Program :end------------------
>
> -----------------Error Message while running :start------------------
> IDL> data_stacker_big1
> % Subscript range values of the form low:high must be >= 0, < size,
> with low <= high: FILE1.
> % Execution halted at: DATA_STACKER_BIG1 12 D:\IDL
> programs\data_stacker_big1.pro
> -----------------Error Message while running :end------------------
>
> Thanking you in advance,
>
> Pranab J. Baruah
> U.Tokyo
IDL> i = 46 & print,((i-1)*720),(i*720-1)
32400 -32417
change
"for i=1,356 do begin"
to
"for i=1L,356 do begin"
i.e. change your variable "i" to a long.
Cheers,
bob
|
|
|