| Re: How to read (large) ASCII arrays into PV-Wave [message #31094 is a reply to message #31084] |
Mon, 17 June 2002 08:46   |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
jeyadev@wrc.xerox.bounceback.com (Surendar Jeyadev) writes:
> I have some floating point, ASCII arrays that I am trying to
> read into PV-Wave. They are not particularly large:
> 232 columns x 50 rows. All numbers are of the form bbbxxx.xxx
> where the 'b' are blank(white) space and the 'x' are digits.
> I have not read such arrays of such size in the past and I was
> surprised to see PV-Wave choke on them. Here is the session log:
(stuff deleted)
> WAVE> d = fltarr(233,50)
> WAVE> openr, 1, 'tt'
> WAVE> readf, 1, d
> % Input line is too long for input buffer of 2048 characters.
> % READF: Error encountered reading from file. Unit: 1
> File: tt
> % Execution halted at $MAIN$ (READF).
> WAVE>exit
> 'wc' tells me that each line is 2085 characters long.
(rest deleted)
Evidently IDL no longer has this limitation, or else it's a much bigger number.
I was able to read in a similuation of your data file without any problem in
IDL/v5.4.
Here's a simple idea. Try using a text editor to reformat the "paragraphs"
into shorter lines. For example, in Emacs this could be done by selecting the
entire file, and then executing the command "fill-region". The numbers won't
line up into nice distinct columns anymore, but you should still be able to
read the array correctly with the above commands, because the numbers are in
the right order.
I tried using the "$" qualifier on the format specifier, but apparently that
only works on output, not input.
If reformatting the input file doesn't appeal to you, it should be possible to
read in each line of the file as a byte array, convert it to strings in
sections, and then read in the data from these substrings. (Does Wave have the
READS command?) That's the sort of thing that makes one refer to the euphemism
"I leave it as an exercise for the reader." ;^)
William Thompson
|
|
|
|