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

Home » Public Forums » archive » Re: Arrays in structures; workarounds?
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: Arrays in structures; workarounds? [message #19959 is a reply to message #19958] Thu, 04 May 2000 00:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"J.D. Smith" <jdsmith@astro.cornell.edu> writes:

> The problem here is reliance on *trailing* shallow dimensions. The
> IDL manual quotes us:
>
> "As with other subscript operations, trailing degenerate dimensions
> (those with a size of 1) are eliminated."
>
> While I can't agree with IDL's mixed notion of a variable's dimensionality
> between help and direct structure member access, I think IDL has always been
> clear about this point.

Yes, this aspect of IDL's behavior is documented. I've complained
about this before because the policy has the habit of biting you at
very awkward moments. As a programmer, you rarely expect the shapes
of your arrays to change without your asking!

But my point here was that there is absolutely *no* legitimate way to
find the true dimensions of a structure tag. Hopefully you will see
why I want this soon enough, when I have time to finish my little
project. It's pretty cool.

> The one place you are justified in complaining is the truncation of a single
> element vector to a scalar: this is a bug (or at least an inconsistency), and
> affects structure field access only:

Bingo. IDL's behavior of trimming degnerate dimensions from variables
is *usually* okay because it still leaves you with an array at the
end. However, when single-element tags in structures are extracted
they are (a) converted to scalars, and (b) there is no way to know
that this happened. Try passing this as X or Y to a routine like PLOT
and you get a crashola. Documented or not, this is ridiculous
behavior.

Multi-element arrays have a similar problem, but I posted a solution
for that. I was hoping to close this final gap...

Oh well,
Craig

P.S. I should be writing a proposal now. Yikes. Back to work..
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Secrets FFTs revealed!!
Next Topic: Re: DXF output/printer device in IDL?

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

Current Time: Fri Oct 10 18:18:07 PDT 2025

Total time taken to generate the page: 0.08178 seconds