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 #72525 is a reply to message #72522] Fri, 17 September 2010 07:16 Go to previous messageGo to previous message
Michael Williams is currently offline  Michael Williams
Messages: 17
Registered: December 2008
Junior Member
On Sep 17, 3:30 pm, Paul van Delst <paul.vande...@noaa.gov> wrote:
> Michael Williams wrote:
>> I have an array of structures:
>
>> IDL> x = {a: 1, b:2, c: indgen(5)}
>> IDL> xx = replicate(x, 10)
>
>> In this case, I want to rename the 'b' tag to 'foo' and the 'c' tag to
>> bar.
>
> Can one inquire why you would like/need to do this?

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: Sat Oct 11 10:20:14 PDT 2025

Total time taken to generate the page: 0.31961 seconds