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

Home » Public Forums » archive » Re: Structure reforming
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Structure reforming [message #31048] Tue, 04 June 2002 09:29
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
"Reimar Bauer" <r.bauer@fz-juelich.de> wrote in message news:3CFCD403.25A83AD4@fz-juelich.de...
> Ivan Valtchanov wrote:
>>
>> Is there any fast way to do it?
>
> You can use my reform_struct.
>
> http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/reform_struct.tar.gz

Nice, very nice! And right in my backyard, too :-)

Jaco
Re: Structure reforming [message #31050 is a reply to message #31048] Tue, 04 June 2002 08:57 Go to previous message
Ivan Valtchanov is currently offline  Ivan Valtchanov
Messages: 8
Registered: April 2002
Junior Member
On Tue, 04 Jun 2002 16:51:47 +0200
Reimar Bauer <r.bauer@fz-juelich.de> wrote:
>
> You can use my reform_struct.
>
> http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/reform_struct.tar.gz
>
>
> regards
>
> Reimar

Thanks a lot... I knew that someone has done it before, logical...

Best regards,
Ivan
Re: Structure reforming [message #31053 is a reply to message #31050] Tue, 04 June 2002 07:51 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Ivan Valtchanov wrote:
>
> Hi all,
>
> I have an IDL structure variable like this:
>
> help, ccc
> CCC STRUCT = -> <Anonymous> Array[1]
>
> help, ccc, /struct
> NAME STRING Array[133]
> RA DOUBLE Array[133]
>
> and I would like to reform it like this
> help,ccc
> CCC STRUCT = -> <Anonymous> Array[133]
> help,ccc,/struct
> NAME STRING g01
> RA DOUBLE 316.022
>
> Is there any fast way to do it?
>
> Thanks a lot.
>
> Ivan

You can use my reform_struct.

http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/reform_struct.tar.gz


regards

Reimar


; NAME:
; reform_struct
;
; PURPOSE:
; This function is used to reform a structure as tag array or struct
array
;
; CATEGORY:
; PROG_TOOLS/STRUCTURES
;
; CALLING SEQUENCE:
;
result=reform_struct(structure,dim1,[dim2],[dim3],[dim4],[di m5],[dim6],[dim7],[dim8],[/struct_array],[/tag_array]
;
; INPUTS:
; structure: a structures
; dim1: the new dimension of the input structure (1D to 8D)
;
; OPTIONAL INPUTS:
; dim2 to dim8: additional dimensions if not declared in dim1
;
; KEYWORD PARAMETERS:
; struct_array: if is set output structure is an array
; tag_array: if is set output structure is 1D and tags are arrays
; You have to set one of these keywords
;
; EXAMPLE:
; data=create_struct('A',FINDGEN(15),'B',SIN(FINDGEN(15)))
; result=reform_struct(data,15,/struct_array)
; HELP,result
; RESULT STRUCT = -> <Anonymous> Array[15]


--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
Re: Structure reforming [message #31057 is a reply to message #31053] Tue, 04 June 2002 04:45 Go to previous message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
"Ivan Valtchanov" <ivanv@discovery.saclay.cea.fr> wrote in message
news:20020604114425.31eda9c4.ivanv@discovery.saclay.cea.fr.. .
> On Tue, 4 Jun 2002 11:30:14 +0200
> "Jaco van Gorkom" <j.c.van.gorkom@fz-juelich.de> wrote:
>> how about:
>> ddd = replicate({name:'', ra:0.d}, 133)
>> ddd.name = ccc.name
>> ddd.ra = ccc.ra
>
> That's the way I am doing it now. But I have some 50-60 tags and they
> are sometimes different from structure to structure...

In that case you might want to create a single-element structure d at
the time you create the ccc array structure. Then you could do
something like
ddd = replicate(d, 133)
for i=0L, n_tags(ccc)-1 do ddd.(i) = ccc.(i)

Alternatively, create the single-element structure d from ccc in a
FOR-loop using TAG_NAMES() and repeated structure concatenation by
CREATE_STRUCT(). Or create the d structure in an EXECUTE() call.

Jaco
Re: Structure reforming [message #31058 is a reply to message #31057] Tue, 04 June 2002 02:44 Go to previous message
Ivan Valtchanov is currently offline  Ivan Valtchanov
Messages: 8
Registered: April 2002
Junior Member
On Tue, 4 Jun 2002 11:30:14 +0200
"Jaco van Gorkom" <j.c.van.gorkom@fz-juelich.de> wrote:
> how about:
> ddd = replicate({name:'', ra:0.d}, 133)
> ddd.name = ccc.name
> ddd.ra = ccc.ra
>
> cheers,
> Jaco

Thanks Jaco,

That's the way I am doing it now. But I have some 50-60 tags and they
are sometimes different from structure to structure...

B+,
Ivan
Re: Structure reforming [message #31059 is a reply to message #31058] Tue, 04 June 2002 02:30 Go to previous message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
"Ivan Valtchanov" <ivanv@discovery.saclay.cea.fr> wrote in message
news:20020604105617.671832ff.ivanv@discovery.saclay.cea.fr.. .
> I have an IDL structure variable like this:
> help, ccc
> CCC STRUCT = -> <Anonymous> Array[1]
> help, ccc, /struct
> NAME STRING Array[133]
> RA DOUBLE Array[133]
>
> and I would like to reform it like this
> help,ccc
> CCC STRUCT = -> <Anonymous> Array[133]
> help,ccc,/struct
> NAME STRING g01
> RA DOUBLE 316.022
>
> Is there any fast way to do it?

how about:
ddd = replicate({name:'', ra:0.d}, 133)
ddd.name = ccc.name
ddd.ra = ccc.ra

cheers,
Jaco
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: atan in IDL 5.5
Next Topic: how to modify the default 'printf' format

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

Current Time: Thu Oct 09 21:26:41 PDT 2025

Total time taken to generate the page: 0.47942 seconds