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

Home » Public Forums » archive » Trailing singular dimensions disappearing. Call for discussion.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Trailing singular dimensions disappearing. Call for discussion. [message #3736] Tue, 28 February 1995 02:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
I have come across the following annoying "feature" of IDL through
a programming project: If you type e.g.,

IDL> HELP, fltarr(10,1,1) ; you get:
<Expression> FLOAT = Array(10)

But if you say

IDL> HELP, fltarr(1,1,10) ; you get:
<Expression> FLOAT = Array(1, 1, 10)

In our applications, it matters that the data arrays retain the
correct number of dimensions, as we have e.g., axis names for each
dimension. The above behaviour is clearly inconsistent, and IDL
is definitely doing something that is not intuitively obvious,
nor is it desirable at all times.

The behaviour I would like is:

Whenever I create an array with so and so many dimensions
(singular as well..), I'd like it to stay that way, until explicitly
told otherwise.

When I'm indexing an array with a scalar, I'd like the dimension to
disappear ("reformed away"), e.g.:

IDL> a=fltarr(10,10)
IDL> help,a(1,1)
<Expression> FLOAT = 0.00000

This is OK, and it's what happens with today's version, but if I do
the following:

IDL> help,a(1,*)
<Expression> FLOAT = Array(1, 10)

or, to make the example complete, we try:

IDL> help,a(*,1)
<Expression> FLOAT = Array(10)

Here I would have liked both expressions (a(1,*) and a(*,1)) to
return the same thing (an Array(10)). I'd still like to be able to
retain a singular dimension by indexing with an array, e.g.:

IDL> help,a(*,[1])
<Expression> FLOAT = Array(10, 1)

So, to sum up: Arrays stay unaltered until otherwise is specified.
Dimensions disappear when indexed with a scalar value, but remain
when indexed with an array (even a single-element one).

In order to make these changes go through with RSI, I'd like to
hear (in this newsgroup) from as many as possible. Of course, if
anyone has large sets of procedures that are tuned directly to
today's behaviour, they are welcome to raise their voice, but
I would argue that their programs would be better off rewritten
with a logical behaviour instead of sneaking dimensions out the
back door.

Sincerely,
Stein Vidar H. Haugan
[Message index]
 
Read Message
Read Message
Previous Topic: Skew-T
Next Topic: Re: Summary: "time_test" for IDL on Windows systems

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

Current Time: Fri Oct 10 17:38:36 PDT 2025

Total time taken to generate the page: 1.03865 seconds