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

Home » Public Forums » archive » Re: Automatic truncation of trailing dimension.....
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Automatic truncation of trailing dimension..... [message #28261 is a reply to message #28260] Tue, 27 November 2001 13:53 Go to previous messageGo to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
"Liam E. Gumley" wrote:
>
> Paul van Delst wrote:
>>
>> .....of an array when the dimension size is 1 is a real pain in the ass. Given:
>>
>> IDL> x=fltarr(100,1,15)
>> IDL> help, x
>> X FLOAT = Array[100, 1, 15]
>>
>> Is there anyway to prevent:
>>
>> IDL> help, x[*,*,1]
>> <Expression> FLOAT = Array[100]
>> IDL>
>>
>> i.e. to give:
>> <Expression> FLOAT = Array[100,1]
>>
>> Argh wot a pain.
>
> I take it you mean
>
> <Expression> FLOAT = Array[100, 1, 1]

No, I mean

<Expression> FLOAT = Array[100,1]

i.e. an rank-2 array where one of the dimensions just happens to be 1. IDL reforms these by
default to a vector. This is a pain. Doesn't do it for arrays dimensioned as [1,100], so I
don't see why it should do it for the other.


> Does your code absolutely require it?

Not usually - except when I run test cases and I process one instance of something rather than
"X" hundred (atmospheric profiles).


> If you must maintain the dimensions:
>
> IDL> dims = size(x, /dimensions)
> IDL> index = 1
> IDL> help, reform(x[*, *, index], dims[0], dims[1], 1)
> <Expression> FLOAT = Array[100, 1, 1]

This is good to know but a pain in the rear to back-implement. To get things working. I just
set my minimum allowed dimension to 2 rather than 1. A work-around rather than a fix. I'm not
going to bother fixing something that shouldn't be broken - and besides, using IDL is supposed
to *enhance* my productivity, not decrease it. :o)

I find this auto-truncate behaviour for arrays with unity dimension in one particular order but
not the other quite ridiculous.

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: New All-Time Records on IDL Newsgroup
Next Topic: Segmentation of Image

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

Current Time: Sat Oct 11 07:11:58 PDT 2025

Total time taken to generate the page: 1.04356 seconds