[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: translating an array name to a string



David Williams wrote:
> 
> Hi. This is probably a very basic IDL question, so apologies if that's
> the case. I'm looking for a way to translate the name of an array (e.g.
> "DATACUBE1") into a string that I can use in titles and/or in feedback
> at the prompt. I want to make my routines more user-friendly, and I hate
> forcing a title
> 
> Say I want to display a frame from a movie of images, called MOVIE. I
> use tvim, and I currently say something like:
> 
>         tvim,MOVIE[*,*,i],$
>         title='frame No.'+ARR2STR(i,/trim)+' of your datacube'.
> 
> (ARR2STR is a SolarSoftWare IDL routine which turns variable values into
> strings, and the TRIM keyword removes unnecessary spaces - very handy!)
> 
> What I'd like to be able to do is say:
> 
>         ...
>         title='frame No.'+ARR2STR(i,/trim)+' of '+ARRNAME2STRING(movie)
> 
> so that I can instantly show which array I'm looking at, as well as
> which frame.
> 
> Nothing obvious springs to my mind, so I thought I'd ask this newsgroup.
> 
> Thanks in advance for any help,
> Dave Williams.<d.williams@qub.ac.uk>
> 
> --

Dave, the question is not so basic as it seems --- at least if you
start thinking about what your user may wish to see as title. I guess
there is a reason why the netcdf people have invented the long_name
attribute... But to solve your actual problem; this can probably be
done with some mystic use of Routine_Info(); Reimar Bauer from Juelich
(r.bauer@fz-juelich.de) is an expert on this.

Cheers,
Martin

-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[