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

Home » Public Forums » archive » Re: REFORM: new subscripts must not change the number elements in array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: REFORM: new subscripts must not change the number elements in array [message #77935] Mon, 17 October 2011 09:22
Brian Wolven is currently offline  Brian Wolven
Messages: 94
Registered: May 2011
Member
I found that once I'd made more than 65535 mistakes I learned not to do things like this. ;)
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 Go to previous message
eva.ivits-wasser is currently offline  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 Go to previous message
David Grier is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: compute quartiles of a distribution
Next Topic: Re: Matrix in IDL

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

Current Time: Wed Oct 08 11:45:19 PDT 2025

Total time taken to generate the page: 0.00622 seconds