Re: storing ASCII_TEMPLATE templates for later use [message #21935] |
Fri, 06 October 2000 00:00 |
Theo Brauers
Messages: 58 Registered: November 1997
|
Member |
|
|
Henk wrote:
>
> Hi,
>
> Is it possible to reuse ASCII_TEMPLATE structures for later use ?
> I find it a very handy tool to describe ascii files, but I don't want to do
> the whole procedure everytime I read a data file. Therefore I would like to
> know how I can store the resulting structure in a file, or type it in in a
> procedure. I will then be able to make a generic file reading routine for
> all my data files.
> Sorry if this is a stupid question, still learning...
>
> Thanks,
>
> Henk
This should work:
PRO create_template(file)
mytemplate = ASCII_TEMPLATE(file)
SAVE, mytemplate, FILENAME='/somewhere/mytemplate.sav'
END
FUNCTION reuse_template(file)
RESTORE, FILENAME='/somewhere/mytemplate.sav'
data = READ_ASCII(file, TEMPLATE=mytemplate)
RETURN, data
END
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
http://www.kfa-juelich.de/icg/icg3/MITARBEITER/th.brauers.ht ml
|
|
|