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

Home » Public Forums » archive » Re: indexing over structure tags
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: indexing over structure tags [message #24807 is a reply to message #24802] Thu, 19 April 2001 11:08 Go to previous messageGo to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Randall Skelton wrote:
>
> Thanks Tom... I did think of that. However, in this particular case there
> is some merit in having the name of the structure be a useful and human
> readable tag. Nobody would be happy trying to remember yet another
> arbitrary numbering scheme for molecules when they'd rather just type the
> name ;) My suspicion is that there isn't an easy way to do what I want...

Maybe more context is needed to solve your problem .... the user of the code *shouldn't*
have to remember the (not so) arbitrary numbering scheme - the user would type in a
molecule name (or names). How your code deals with searching the human readable tagnames
is a different matter, no?

e.g.

; define the basic structure for each
sm_struc = {basic_struct, comment: ' ', values: fltarr(nlev)}

; define the large structure
data = {big_struct, so4: sm_struc, co2: sm_struc, hcl: sm_struc}

; get the names of the tags
names = tag_names(data)

so that names = [so4, co2, hcl].

Say the user requests data for 'so4' and 'hcl' so how about

user_request = ['so4', 'hcl']
n_requests = N_ELEMENTS( user_request )

FOR i = 0, n_requests - 1 DO BEGIN
tag_number = (WHERE( user_request[i] EQ names ))[0] ; <-- assume this always succeeds
data_to_get = data.(tag_number).values
IF ( i EQ 0 ) THEN $
data_to_return = data_to_get $
ELSE $
data_to_return = [ [ data_to_return ], [ data_to_get ] ]
ENDFOR

RETURN, data_to_return


or something like that? As it is above might not work for plucking out structures, but
that's a detail. So is the concatenation build of the data_to_return. Should be o.k. for
small arrays tho'.

paulv

--
Paul van Delst A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain,
Fax:(301)763-8545 And drinking largely sobers us again.
paul.vandelst@noaa.gov Alexander Pope.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: fastest operations/fctns.
Next Topic: MBAR

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

Current Time: Wed Oct 08 18:40:29 PDT 2025

Total time taken to generate the page: 0.00408 seconds