Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Stephan Oerder <Oerder@nv.et-inf.uni-siegen.de> writes: > I have a problem : > IDL/WAVE informs me that my big structure have too many tags !!! > So I decided to to devide the big structure into two smaller ones... > I try to create a structure of a structure : > fr_1 = { STRUCT_1_NAME, $ > Test_1:bytarr(12), $ > Test_2:bytarr(12), $ > Test_3:bytarr(12) $ > } > fr_2 = { STRUCT_2_NAME, $ > Test_a:bytarr(12), $ > Test_b:bytarr(12), $ > Test_c:bytarr(12) $ > } > fr = { STRUCT_NAME, $ > struct_var_2 : {STRUCT_1_NAME}, $ > struct_var_2 : {STRUCT_2_NAME}, $ > } > This is not working !!!! > How can I create a structure of a structure ??? > Stephan Your problem is extremely simple. You have a couple of simple typos in the final command. (It happens to the best of us.) If you instead enter in fr = { STRUCT_NAME, $ struct_var_1 : {STRUCT_1_NAME}, $ struct_var_2 : {STRUCT_2_NAME} $ } it should work fine. Bill Thompson
create_structure is a build-in function of IDL. It should work on all systems. As far as I remember there was a problem with structures of of structures in IDL3.xx or IDL 4.xx but who cares? I am using IDL 5.0.3 on WinNT. Theo Stephan Oerder wrote: > > Thanks a lot !!! > I tried it already on a PC-IDL-System !!!! > But we need it on a VAX-VMS-System !!! > Do you (or somebody else) have the PRO-File of "Create_Struct(...)" ??? > Stephan > > Theo Brauers wrote: >> You may try: >> >> m1 = create_struct('a', 0, 'b', bytarr(12)) >> m2 = create_struct(name='m2_str', 'a', 0, 'c', fltarr(12)) >> ; array of structures >> m3 = replicate(m2, 3) >> >> m = create_struct('a1', m1) >> m = create_struct(m, 'a2' , m2) >> m = create_struct(m, 'a3' , m3) >> >> Best, Theo >> ---------------------------------------------- >> Dr. Theo Brauers >> Institut fuer Atmosphaerische Chemie (ICG-3) >> Forschungszentrum Juelich >> 52425 JUELICH, Germany >> Tel. +49-2461-61-6646 Fax. +49-2461-61-5346 -- ---------------------------------------------- Dr. Theo Brauers Institut fuer Atmosphaerische Chemie (ICG-3) Forschungszentrum Juelich 52425 JUELICH, Germany Tel. +49-2461-61-6646 Fax. +49-2461-61-5346
Thanks a lot !!! I tried it already on a PC-IDL-System !!!! But we need it on a VAX-VMS-System !!! Do you (or somebody else) have the PRO-File of "Create_Struct(...)" ??? Stephan Theo Brauers wrote: > You may try: > > m1 = create_struct('a', 0, 'b', bytarr(12)) > m2 = create_struct(name='m2_str', 'a', 0, 'c', fltarr(12)) > ; array of structures > m3 = replicate(m2, 3) > > m = create_struct('a1', m1) > m = create_struct(m, 'a2' , m2) > m = create_struct(m, 'a3' , m3) > > Best, Theo > ---------------------------------------------- > Dr. Theo Brauers > Institut fuer Atmosphaerische Chemie (ICG-3) > Forschungszentrum Juelich > 52425 JUELICH, Germany > Tel. +49-2461-61-6646 Fax. +49-2461-61-5346
You may try: m1 = create_struct('a', 0, 'b', bytarr(12)) m2 = create_struct(name='m2_str', 'a', 0, 'c', fltarr(12)) ; array of structures m3 = replicate(m2, 3) m = create_struct('a1', m1) m = create_struct(m, 'a2' , m2) m = create_struct(m, 'a3' , m3) Best, Theo Stephan Oerder wrote: > > I have a problem : > IDL/WAVE informs me that my big structure have too many tags !!! > So I decided to to devide the big structure into two smaller ones... > I try to create a structure of a structure : > > fr_1 = { STRUCT_1_NAME, $ > Test_1:bytarr(12), $ > Test_2:bytarr(12), $ > Test_3:bytarr(12) $ > } > > fr_2 = { STRUCT_2_NAME, $ > Test_a:bytarr(12), $ > Test_b:bytarr(12), $ > Test_c:bytarr(12) $ > } > > fr = { STRUCT_NAME, $ > struct_var_2 : {STRUCT_1_NAME}, $ > struct_var_2 : {STRUCT_2_NAME}, $ > } > > This is not working !!!! > How can I create a structure of a structure ??? > Stephan -- ---------------------------------------------- Dr. Theo Brauers Institut fuer Atmosphaerische Chemie (ICG-3) Forschungszentrum Juelich 52425 JUELICH, Germany Tel. +49-2461-61-6646 Fax. +49-2461-61-5346
Stephan Oerder wrote: > > <snip of Bill's solution> > >> Bill Thompson > > Thanks 1000 * times !!! > > This was not the main problem !!! > My problem is that under IDL 3.xx and IDL 4.xx > IDL have a problem with Structure of Structure definitions. > I tested your routine under IDL 3.xx and IDL 4.xx (PC, Vax-VMS) and it > was not working . > But under IDL 5.0 (Alpha) it works... > -> let's update... > Stephan The problem may not be with the definition of a stucture within a structure, but may simply be that IDL prior to version 5.0 had a maximum number of structure tags allowed (don't know the number off the top of my head). Nesting the structures may not help as this was an internal limitation. Dave -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ David S. Foster Univ. of California, San Diego Programmer/Analyst Brain Image Analysis Laboratory foster@bial1.ucsd.edu Department of Psychiatry (619) 622-5892 8950 Via La Jolla Drive, Suite 2240 La Jolla, CA 92037 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
William Thompson wrote: > > Stephan Oerder <Oerder@nv.et-inf.uni-siegen.de> writes: > >> I have a problem : >> IDL/WAVE informs me that my big structure have too many tags !!! >> So I decided to to devide the big structure into two smaller ones... >> I try to create a structure of a structure : > >> fr_1 = { STRUCT_1_NAME, $ >> Test_1:bytarr(12), $ >> Test_2:bytarr(12), $ >> Test_3:bytarr(12) $ >> } > >> fr_2 = { STRUCT_2_NAME, $ >> Test_a:bytarr(12), $ >> Test_b:bytarr(12), $ >> Test_c:bytarr(12) $ >> } > >> fr = { STRUCT_NAME, $ >> struct_var_2 : {STRUCT_1_NAME}, $ >> struct_var_2 : {STRUCT_2_NAME}, $ >> } > >> This is not working !!!! >> How can I create a structure of a structure ??? >> Stephan > > Your problem is extremely simple. You have a couple of simple typos in the > final command. (It happens to the best of us.) If you instead enter in > > fr = { STRUCT_NAME, $ > struct_var_1 : {STRUCT_1_NAME}, $ > struct_var_2 : {STRUCT_2_NAME} $ > } > > it should work fine. > > Bill Thompson Thanks 1000 * times !!! This was not the main problem !!! My problem is that under IDL 3.xx and IDL 4.xx IDL have a problem with Structure of Structure definitions. I tested your routine under IDL 3.xx and IDL 4.xx (PC, Vax-VMS) and it was not working . But under IDL 5.0 (Alpha) it works... -> let's update... Stephan
Stephan Oerder wrote: > > Thanks a lot !!! > I tried it already on a PC-IDL-System !!!! > But we need it on a VAX-VMS-System !!! > Do you (or somebody else) have the PRO-File of "Create_Struct(...)" ??? > Stephan > > Theo Brauers wrote: >> You may try: >> >> m1 = create_struct('a', 0, 'b', bytarr(12)) >> m2 = create_struct(name='m2_str', 'a', 0, 'c', fltarr(12)) >> ; array of structures >> m3 = replicate(m2, 3) >> >> m = create_struct('a1', m1) >> m = create_struct(m, 'a2' , m2) >> m = create_struct(m, 'a3' , m3) >> >> Best, Theo >> ---------------------------------------------- >> Dr. Theo Brauers >> Institut fuer Atmosphaerische Chemie (ICG-3) >> Forschungszentrum Juelich >> 52425 JUELICH, Germany >> Tel. +49-2461-61-6646 Fax. +49-2461-61-5346 You might also want to look at a function I wrote a few years ago called MRD_STRUCT. It takes two string array arguments. The first gives the names of the structure columns and the second gives a prototype for what the column should look like. E.g., A call would might look like: names = ["name_for_col1", "name_for_col2",...] vals = ["dblarr(10,10)", "0L", "intarr(3,2,4), ...] str = mrd_struct(names, vals) with additional optional arguments to create an array of structures or to define the structure type. If you request a structure of more than 128 elements, then the routine automatically creates substructures, putting the first 64 elements in the top level structure, the next 64 in a structure as the 65th element and so forth. I believe this has run successfully on VAXes for versions of IDL > 3.6. It's available in the IDL Astronomy library at: http://idlastro.gsfc.nasa.gov/ftp/pro/structure/mrd_struct.p ro Good luck, Tom McGlynn tam@silk.gsfc.nasa.gov
"Thomas A. McGlynn" <tam@silk.gsfc.nasa.gov> writes: > Stephan Oerder wrote: > with additional optional arguments to create an array of > structures or to define the structure type. If you request a > structure of more than 128 elements, then the routine automatically > creates substructures, putting the first 64 elements in the > top level structure, the next 64 in a structure as the 65th element > and so forth. I believe this has run successfully on VAXes > for versions of IDL > 3.6. this is similar to my IDL 5.0 bug i found in idl 4.01 at 23.Dec. 96 which is known to RSI as an internal kernel-Bug of IDL! i worte a programm that hung the maschine: pro fail for te=1,105 do begin anzahl=te tname=strarr(anzahl) for i=0,anzahl-1 do tname(i)='TN_'+strcompress(string(i),/remove_all) ttyp=strarr(anzahl) ; zum ausuchen / try one of it ttyp(*)="'String-test'" ttyp(*)="fltarr(10)" ttyp(*)="dcomplexarr(102)" ziel=byte(0) estring='ziel={' for i=0,anzahl-1 do begin if i gt 0 then estring=estring+',' estring=estring+tname(i)+':'+ttyp(i) endfor estring=estring+'}' if execute(estring) then begin print,' Execute OK: ',te endif else begin goto,abbruch endelse endfor abbruch: print, ' Execute failed at ',te end Even worse is the switshing of the data-type every time! Panther > It's available in the IDL Astronomy library at: > http://idlastro.gsfc.nasa.gov/ftp/pro/structure/mrd_struct.p ro > Good luck, > Tom McGlynn > tam@silk.gsfc.nasa.gov -- Panther in the Jungle __..--''``\--....___ _..,_ -BELIEVE AND DECEIVE- _.-' .-/"; ` ``<._ ``-+'~=. http://www.ang-physik _.-' _..--.'_ \ `(^) ) .uni-kiel.de/~hendrik ((..-' (< _ ;_..__ ; `'