|
Re: REFORM: new subscripts must not change the number elements in array [message #77949 is a reply to message #77935] |
Sun, 16 October 2011 01:18  |
eva.ivits-wasser
Messages: 8 Registered: October 2011
|
Junior Member |
|
|
Ohhhhhh...that was it!
Sorry for such a beginners mistake but thanks a lot for your help!
Cheers,
Eva
On Oct 15, 3:38 pm, David Grier <david.gr...@nyu.edu> wrote:
> Hi Eva,
>
> If ns and nl are "regular" integers, then ns * nl can overflow the
> maximum integer, leading to the behavior you describe.
>
> Casting ns and nl to long integers will fix this:
>
> IDL> ns = 1194
> IDL> nl = 686
> IDL> print, ns * nl ; WRONG
> 32652
>
> IDL> ns = 1194L
> IDL> nl = 686L
> IDL> print, ns * nl ; RIGHT
> 819084
>
> TTFN,
>
> David
>
> On 10/15/11 7:34 AM, eva.ivits-was...@ext.jrc.ec.europa.eu wrote:
>
>
>
>
>
>
>
>> Good day,
>
>> I have a 3D array of
>> ts=Int[1194,12,686]
>
>> It's an image with 1194 columns, 12 bands and 686 lines.
>
>> I'm running REFORM on the transposed array but get the well known
>> error message:
>> "REFORM: New subscripts must not change the number elements in
>> <INT Array[1194, 686, 12]>"
>
>> This is what I'm doing:
>> tr=reform(transpose(ts,[0,2,1]),ns*nl,nb)
>
>> i.e. first I transpose the lines onto the second dimension and then
>> create "tr" so that it is a 2D array of ns*nl (1194*686) and nb (12).
>
>> Why isn't it working?
>
>> I'm desparate....pls help!
>
>> Thanks,
>
>> Eva
|
|
|
Re: REFORM: new subscripts must not change the number elements in array [message #77951 is a reply to message #77949] |
Sat, 15 October 2011 06:38  |
David Grier
Messages: 35 Registered: July 2010
|
Member |
|
|
Hi Eva,
If ns and nl are "regular" integers, then ns * nl can overflow the
maximum integer, leading to the behavior you describe.
Casting ns and nl to long integers will fix this:
IDL> ns = 1194
IDL> nl = 686
IDL> print, ns * nl ; WRONG
32652
IDL> ns = 1194L
IDL> nl = 686L
IDL> print, ns * nl ; RIGHT
819084
TTFN,
David
On 10/15/11 7:34 AM, eva.ivits-wasser@ext.jrc.ec.europa.eu wrote:
> Good day,
>
> I have a 3D array of
> ts=Int[1194,12,686]
>
> It's an image with 1194 columns, 12 bands and 686 lines.
>
> I'm running REFORM on the transposed array but get the well known
> error message:
> "REFORM: New subscripts must not change the number elements in
> <INT Array[1194, 686, 12]>"
>
> This is what I'm doing:
> tr=reform(transpose(ts,[0,2,1]),ns*nl,nb)
>
> i.e. first I transpose the lines onto the second dimension and then
> create "tr" so that it is a 2D array of ns*nl (1194*686) and nb (12).
>
> Why isn't it working?
>
> I'm desparate....pls help!
>
> Thanks,
>
> Eva
|
|
|