can't make array [message #87607] |
Mon, 17 February 2014 22:48  |
kamal
Messages: 12 Registered: June 2010
|
Junior Member |
|
|
Hi all,
I am trying to write an IDL code for reading a number of binary files (366 in total) with the dimensions x=1940, y=1940. However, this seems to be quite a large number for making an array. I am not being able to generate an array containing such a huge number of elements. Is there a way out to tackle this awkward situation?
Any suggestions in this regard would be highly appreciated.
The part of my code looks something like this:
...somthing else....
;The portion where error is coming....
x=1940 & y = x
z = nfiles ;366
nodata = -33.00
temparr = fltarr(x,y,z) ;<<<<<Error comes in this line
for k = 0, z-1 do begin
file = infiles[k]
data = read_binary(file, data_dims=[x,y], data_type=4)
temparr[*,*,k] = data
endfor
....something else....
Thanks in advance.
Cheers,
Kamal
|
|
|
Re: can't make array [message #87610 is a reply to message #87607] |
Tue, 18 February 2014 04:19   |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
> dimensions x=1940, y=1940. However, this seems to be quite a large number for making an array...
It took a couple seconds, but IDL can do this
IDL> help, fltarr(1940,1940,366)
<Expression> FLOAT = Array[1940, 1940, 366]
Your problem may be that z is undefined or zero. Make sure that "nfiles" is actually a number other than zero.
> x=1940 & y = x
> z = nfiles ;366
> temparr = fltarr(x,y,z) ;<<<<<Error comes in this line
What is the error that you are getting?
|
|
|
Re: can't make array [message #87611 is a reply to message #87607] |
Tue, 18 February 2014 07:16  |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
On Tuesday, February 18, 2014 12:48:22 AM UTC-6, kamal wrote:
>
> I am trying to write an IDL code for reading a number of binary files (366 in total) with the dimensions x=1940, y=1940. However, this seems to be quite a large number for making an array. I am not being able to generate an array containing such a huge number of elements. Is there a way out to tackle this awkward situation?
>
Well, you're trying to create a 1940*1940*366*32 bit array. That's something around 5GB. Does your computer have enough memory?
On Tuesday, February 18, 2014 6:19:47 AM UTC-6, Matthew Argall wrote:
>
>
>> x=1940 & y = x
>
>> z = nfiles ;366
>
>> temparr = fltarr(x,y,z) ;<<<<<Error comes in this line
>
>
>
> What is the error that you are getting?
This.
|
|
|