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

Home » Public Forums » archive » Array index bug....
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 index bug.... [message #14328] Sun, 21 February 1999 00:00 Go to next message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
Try this:

data = transpose([[[dist(50)]],[[dist(50)]]],[2,0,1])
help,data
; DATA FLOAT = Array[2, 50, 50]

tvscl,data(0,*,*) ;; Shows the expected image...

But, imagine that you're writing a general program that must
accept arrays with any number of dimensions, and extract data
from the array in (n-1)-dimensional "slices" like the
above. Short of having a CASE statement for every extraction
of data from the array, the way to do this is e.g.:

tvscl,data(0,*,*,*,*) ;; Shows the expected image in this case,
;; works for up to 5 dimensions (though
;; I don't know what TVSCL would say about
;; that!)

Now, IDL *claims* to handle up to 8 dimensions, so one would think
the best thing is to prepare your code for it, e.g.:

tvscl,data(0,*,*,*,*,*,*,*)

The image is *not* what you expect! Clearly something breaks
down with the eighth dimension.....

Another matter is, how do you create e.g., 4-dimensional data
sets with the concatenation style? Lets see:

IDL> help,[1,2]
<Expression> INT = Array[2]
IDL> help,[[1],[2]]
<Expression> INT = Array[1, 2]
IDL> help,[[[1]],[[2]]]
<Expression> INT = Array[1, 1, 2]
IDL> help,[[[[1]]],[[[2]]]]

help,[[[[1]]],[[[2]]]]
^
% Only eight levels of variable concatenation are allowed.

Hmm. Very strange indeed, since I don't even have 8 opening
(or closing) brackets in total, much less anything going to
what *I* would interpret as 8 levels of concatenation....

Regards,

Stein Vidar
Re: Array index bug.... [message #16260 is a reply to message #14328] Mon, 12 July 1999 00:00 Go to previous message
luthi is currently offline  luthi
Messages: 20
Registered: March 1999
Junior Member
Gwyn

I tried your code with PV-Wave (6.1, Solaris 2.6) and anything looks ok, until
I use nine subscripts:

print,a(0,*,*,*,*,*,*,*,*)
% Only 8 subscripts allowed.

(btw: Have you tried using parentheses instead of brackets for array indexing,
if this is still allowed in IDL. Probably this could work since both IDL and
PV-Wave once had the same code base... who knows!)

Cheers

Martin

--
============================================================
Martin Luethi Tel. +41 1 632 40 92
Glaciology Section Fax. +41 1 632 11 92
VAW ETH Zuerich
CH-8092 Zuerich mail luthi@vaw.baum.ethz.ch
Switzerland
============================================================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: NNLS algorithm
Next Topic: Keyword bug in CW_BGROUP??

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

Current Time: Wed Oct 08 18:56:39 PDT 2025

Total time taken to generate the page: 0.00455 seconds