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

Home » Public Forums » archive » Re: Renaming tags in an array 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: Renaming tags in an array of structures [message #72522] Fri, 17 September 2010 07:50 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
Check out the ALIAS keyword in mrdfits.pro

; ALIAS The keyword allows the user to specify the column
names
; to be created when reading FITS data. The value of
; this keyword should be a 2xn string array. The first
; value of each pair of strings should be the desired
; tag name for the IDL column. The second should be
; the FITS TTYPE value.

This is probably more efficient than changing the tag names after the
structure has been read, though I realize that you might not know the
names you need until after the file is read. (And I haven't used
the ALIAS keyword much so I can't vouch for it.) --Wayne

On Sep 17, 10:16 am, Michael Williams <mjwilli...@gmail.com> wrote:
>
> I'm reading in a FITS file (data format used in astronomy) that I did
> not create. The library function I'm using to do this (mrdfits from
> astroidl) returns an array of structures. The names of the tags are
> specified in the fits file itself.
>
> It so happens that in this new file I'm working with, these names do
> not match the choices used for the same data in all my other files.
> For example, let's say I want to plot old_data.speed against
> new_data.speed. But new_data doesn't have a .speed tag. It calls
> it .velocity. If it's just one tag and just one case, then hard coding
> something would work, but as the number of tags grows this becomes
> ugly and error prone. It would be much easier and more general to just
> rename tags. Unfortunately that seems to be non-trivial in IDL.
>
> In my case, the best thing to do is probably to edit the FITS file at
> source and change the header so that the tag names match. That may not
> be possible (or desirable from a data purity point of view) in all
> circumstances, and renaming data structures or changing the metadata
> associated with a strucure should of course be possible in a modern
> language! Hence this question :-)
>
> -- Mike
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: color tiffs
Next Topic: Re: IDL 8.0; difficulties with "New Graphics"

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

Current Time: Fri Oct 10 07:46:31 PDT 2025

Total time taken to generate the page: 0.23980 seconds