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

Home » Public Forums » archive » Re: Change structure tags from float to double
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: Change structure tags from float to double [message #67204] Wed, 08 July 2009 08:30 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Anthony schrieb:
> Hi again,
>
> David - I'm reading data using MRDFITS - not sure I can convert the
> data when reading it in??
>
> Reimar - does it work on arrays of structures? I tried this:

not directly but you can call reform_struct beforehand
http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dbase/reform_struct_dbase.pro.html
and afterwards

wget
http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dbase/download/reform_struct.sav


IDL> x2 = reform_struct(x,5,/tag)
IDL> help,x2
X2 STRUCT = -> <Anonymous> Array[1]

y = replace_tagvalue(x2, 'A', double(x.a))

x = reform_struct(y,5,/str)
IDL> help ,x
X STRUCT = -> <Anonymous> Array[5]
IDL> help ,x,/str
** Structure <1dc3b78>, 2 tags, length=16, data length=10, refs=1:
A DOUBLE 0.0000000
B INT 0

cheers
Reimar

>
> IDL> x = replicate({a:0., b:0}, 5)
> IDL> help, x
> X STRUCT = -> <Anonymous> Array[5]
> IDL> help, x, /struct
> ** Structure <15ee908>, 2 tags, length=8, data length=8, refs=1:
> A FLOAT 0.00000
> B LONG 0
> IDL> y = replace_tagvalue(x, 'A', double(x.a))
> IDL> help, y
> Y STRUCT = -> <Anonymous> Array[1]
> IDL> help, y, /struct
> ** Structure <15f5518>, 2 tags, length=64, data length=60, refs=1:
> A DOUBLE Array[5]
> B LONG Array[5]
>
> ... but it completely changed the structure.
>
> Maybe I'll just edit the FITS file manually...
>
> Anthony
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Change structure tags from float to double
Next Topic: Re: "idl___ is not available for this system (solaris2.x86_64)

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

Current Time: Fri Oct 10 01:47:17 PDT 2025

Total time taken to generate the page: 1.35723 seconds