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

Home » Public Forums » archive » Array subscript for ARRAY must have same size as source expression
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
Array subscript for ARRAY must have same size as source expression [message #90688] Fri, 27 March 2015 04:36 Go to next message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Hello

I have the following code:

ArrayNEW = ArrayDATA

FOR i=0, n-1 do begin
A1[i,*,*] = A1_tmp
A2[i,*,*] = A2_tmp
ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*])
endfor

The dimensions of the arrays are as follow:
A1_tmp FLOAT = Array[120, 4, 4]
A2_tmp FLOAT = Array[120, 4, 4]
ArrayDATA FLOAT = Array[120, 216, 216]
ArrayNEW FLOAT = Array[120, 216, 216]

calculate - it's a function which takes those arguments and interpolate the A1_tmp,A2_tmp to have the same dimensions as ArrayDATA.

As I send these arguments to the function why they should have the same dimensions?
Re: Array subscript for ARRAY must have same size as source expression [message #90689 is a reply to message #90688] Fri, 27 March 2015 05:59 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
You don't say at which line the error is occurring, or at which line you are displaying the data sizes. Certainly one suspicious place is

> A1[i,*,*] = A1_tmp

where A1_tmp FLOAT = Array[120, 4, 4]

So you are trying to assign all 3 dimensions of A1_tmp into the last two dimensions of A1. Maybe you wanted subscripts for A1_tmp ? --Wayne


On Friday, March 27, 2015 at 7:36:41 AM UTC-4, g.na...@gmail.com wrote:
> Hello
>
> I have the following code:
>
> ArrayNEW = ArrayDATA
>
> FOR i=0, n-1 do begin
> A1[i,*,*] = A1_tmp
> A2[i,*,*] = A2_tmp
> ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*])
> endfor
>
> The dimensions of the arrays are as follow:
> A1_tmp FLOAT = Array[120, 4, 4]
> A2_tmp FLOAT = Array[120, 4, 4]
> ArrayDATA FLOAT = Array[120, 216, 216]
> ArrayNEW FLOAT = Array[120, 216, 216]
>
> calculate - it's a function which takes those arguments and interpolate the A1_tmp,A2_tmp to have the same dimensions as ArrayDATA.
>
> As I send these arguments to the function why they should have the same dimensions?
Re: Array subscript for ARRAY must have same size as source expression [message #90690 is a reply to message #90688] Fri, 27 March 2015 06:24 Go to previous messageGo to next message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Yeah, you are right. No the error is occurring in this line

ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*])
Re: Array subscript for ARRAY must have same size as source expression [message #90691 is a reply to message #90690] Fri, 27 March 2015 08:56 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Friday, March 27, 2015 at 9:24:07 AM UTC-4, g.na...@gmail.com wrote:
> Yeah, you are right. No the error is occurring in this line
>
> ArrayNEW[i,*,*] = calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*])

Have you checked that the calculate() function is doing what you think it is doing?, i.e. after the program crashes,

help, calculate(A1_tmp,A2_tmp,ArrayDATA[i,*,*])
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Draw a circle enclosed to the other
Next Topic: Translating a Python program to IDL

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

Current Time: Wed Oct 08 09:22:37 PDT 2025

Total time taken to generate the page: 0.00517 seconds