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

Home » Public Forums » archive » Re: Structure of arrays or arrays of structures?
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: Structure of arrays or arrays of structures? [message #64841 is a reply to message #64837] Fri, 23 January 2009 00:11 Go to previous messageGo to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Brian Larsen schrieb:
> All,
>
> this may be philosophy but I have fought with both today and I am
> wondering if there are pros and cons to the different
> implementations.
>
> My example is that when I read in text files I build a structure of
> arrays:
> IDL> help, data
> DATA STRUCT = -> <Anonymous> Array[1]
> IDL> help, data, /str
> ** Structure <1a07a08>, 5 tags, length=212480, data length=212480,
> refs=1:
> JD DOUBLE Array[5312]
> PAS0 DOUBLE Array[5312]
> PAS90 DOUBLE Array[5312]
> MEP0E3 DOUBLE Array[5312]
> MEP90E3 DOUBLE Array[5312]
>
> and when I read cdf data (at least from ACE) I get arrays of
> structures
> IDL> help, data
> DATA STRUCT = -> <Anonymous> Array[36451]
> IDL> help, data, /str
> ** Structure <19cf008>, 45 tags, length=200, data length=196, refs=1:
> DNUM DOUBLE 0.0000000
> YEAR LONG 2007
> DAY LONG 165
> HR LONG 0
> MIN LONG 0
> SEC FLOAT 8.98560
>
> Are there memory issues with one way or the other? Other things I
> haven't thought about?
>
> I prefer the feel of the structure of arrays since I like typing
> tmp = data.jd[0:10]
> more than I like typing
> tmp = data[0:10].jd

Hi

well with the last one you can quite easy create slices of your data set
by result = data[ix]. It also could be used with table widgets or for an
example by xvaredit.

Your prefered solution is easy to use for all kind of tag manipulation,
e.g. removing, renaming, adding another tag into the same structure.

Long time ago we have added reform_struct to our library.
http://www.fz-juelich.de/zb/datapool/page/439/00322_Bauer.pd f page 57
(text in german, examples in idl)

cheers
Reimar





>
>
> Cheers,
>
> Brian
>
> ------------------------------------------------------------ --------------
> Brian Larsen
> Boston University
> Center for Space Physics
> http://people.bu.edu/balarsen/Home/IDL
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: BAR_PLOT with pairs of bars
Next Topic: A new version of GRAFFER

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

Current Time: Sat Oct 11 15:52:32 PDT 2025

Total time taken to generate the page: 2.47748 seconds