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

Home » Public Forums » archive » template for READ_ASCII
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
template for READ_ASCII [message #25479] Sun, 24 June 2001 18:26 Go to next message
Bob Fugate is currently offline  Bob Fugate
Messages: 18
Registered: March 2001
Junior Member
Greetings all,
I am a newbie so bear with me.

I want to read csv text files all having the same size and format but with
elements having different numerical values. Each row is composed of 5
numbers, longs and floats, arranged in columns such that each column has
numbers of the same format. Each file has the same number of rows.

If I create a template with ASCII_TEMPLATE and apply READ_ASCII, it works
great. I can do this from the command line or from a procedure. When the
procedure reaches the ASCII_TEMPLATE call, it puts up the GUI with its
subsequent pages and the program continues fine after I select the "next"
and "finish" buttons.

My question is, can I save the template somehow so I don't have to
regenerate it with ASCII_TEMPLATE each time I restart IDL and want to read
new tables? I realize I only have to run ASCII_TEMPLATE once each session
but I would like to make this completely automatic and so I don't have to
manually go through the GUI each day. It is not a really big deal but I am
getting greedy.

Thanks for any help or suggested better approaches.

Bob Fugate
Re: template for READ_ASCII [message #25566 is a reply to message #25479] Mon, 25 June 2001 18:52 Go to previous message
Bob Fugate is currently offline  Bob Fugate
Messages: 18
Registered: March 2001
Junior Member
Alex,
This is great. It is the first time I have seen a simple example of how a
structure is constructed. My template is so simple, I really like this
approach. I now have 2 solutions. Great!! Thanks again.

Bob

> From: Alex Schuster <Wonko@planet-interkom.de>
> Organization: Der Alex
> Newsgroups: comp.lang.idl-pvwave
> Date: Mon, 25 Jun 2001 12:44:55 +0200
> Subject: Re: template for READ_ASCII
>
> Bob Fugate wrote:
>
>> My question is, can I save the template somehow so I don't have to
>> regenerate it with ASCII_TEMPLATE each time I restart IDL and want to read
>> new tables? I realize I only have to run ASCII_TEMPLATE once each session
>> but I would like to make this completely automatic and so I don't have to
>> manually go through the GUI each day. It is not a really big deal but I am
>> getting greedy.
>
> There is the SAVE method already mentioned in this thread, but another
> possibility would be the creation of the template in your program like I
> just did in one of mine:
>
> template = { $
> version : 1.0, $
> datastart : 9, $
> delimiter : 32B, $
> missingvalue : !values.f_nan, $
> commentsymbol : '', $
> fieldcount : 8L, $
> fieldtypes : [ 3, 4, 4, 4, 4, 4, 4, 4 ], $
> fieldnames : [ 'time', 'xyz', 'field3', 'field4', $
> 'field5', 'field6', 'field7', 'winkel' ], $
> fieldlocations : [ 0, 3, 8, 14, 22, 27, 33, 40 ], $
> fieldgroups : [ 0, 1, 1, 1, 1, 1, 1, 7 ] }
>
> Just do a HELP, mytemplate, /STRUCT, and you will see what kind of
> struct the template is. There is nothing wrong with using SAVE and
> RESTORE, but sometimes I like to avoid extra files and prefer a single
> one.
>
> Alex
> --
> Alex Schuster Wonko@planet-interkom.de
> alex@pet.mpin-koeln.mpg.de
Re: template for READ_ASCII [message #25568 is a reply to message #25479] Mon, 25 June 2001 15:26 Go to previous message
m.hadfield is currently offline  m.hadfield
Messages: 36
Registered: April 2001
Member
From: "Alex Schuster" <Wonko@planet-interkom.de>
> There is the SAVE method already mentioned in this thread, but another
> possibility would be the creation of the template in your program like I
> just did in one of mine:
>
> template = { $
> version : 1.0, $
> datastart : 9, $
> delimiter : 32B, $
> missingvalue : !values.f_nan, $
> commentsymbol : '', $
> fieldcount : 8L, $
> fieldtypes : [ 3, 4, 4, 4, 4, 4, 4, 4 ], $
> fieldnames : [ 'time', 'xyz', 'field3', 'field4', $
> 'field5', 'field6', 'field7', 'winkel' ], $
> fieldlocations : [ 0, 3, 8, 14, 22, 27, 33, 40 ], $
> fieldgroups : [ 0, 1, 1, 1, 1, 1, 1, 7 ] }

Good point, Alex. I considered this some time ago but decided that I
couldn't be bothered decoding the format of the template structures. I guess
they're not too bad if you write them out carefully. Your example will go
into my personal repository of useful IDL tips.
---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research




--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
Re: template for READ_ASCII [message #25573 is a reply to message #25479] Mon, 25 June 2001 03:44 Go to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
Bob Fugate wrote:

> My question is, can I save the template somehow so I don't have to
> regenerate it with ASCII_TEMPLATE each time I restart IDL and want to read
> new tables? I realize I only have to run ASCII_TEMPLATE once each session
> but I would like to make this completely automatic and so I don't have to
> manually go through the GUI each day. It is not a really big deal but I am
> getting greedy.

There is the SAVE method already mentioned in this thread, but another
possibility would be the creation of the template in your program like I
just did in one of mine:

template = { $
version : 1.0, $
datastart : 9, $
delimiter : 32B, $
missingvalue : !values.f_nan, $
commentsymbol : '', $
fieldcount : 8L, $
fieldtypes : [ 3, 4, 4, 4, 4, 4, 4, 4 ], $
fieldnames : [ 'time', 'xyz', 'field3', 'field4', $
'field5', 'field6', 'field7', 'winkel' ], $
fieldlocations : [ 0, 3, 8, 14, 22, 27, 33, 40 ], $
fieldgroups : [ 0, 1, 1, 1, 1, 1, 1, 7 ] }

Just do a HELP, mytemplate, /STRUCT, and you will see what kind of
struct the template is. There is nothing wrong with using SAVE and
RESTORE, but sometimes I like to avoid extra files and prefer a single
one.

Alex
--
Alex Schuster Wonko@planet-interkom.de
alex@pet.mpin-koeln.mpg.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: searching for available license
Next Topic: Finding values in an array

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

Current Time: Wed Oct 08 15:22:54 PDT 2025

Total time taken to generate the page: 0.00463 seconds