Re: Reading large Ascii files [message #27632 is a reply to message #27631] |
Tue, 30 October 2001 08:48   |
Isa Usman
Messages: 13 Registered: October 2001
|
Junior Member |
|
|
Martin,
I decided to run your code on my machine with the only change being the
file path and it is giving me a buffer error. This means that probably the
problem is machine specific. See below
Thanks
Isa
{ x86 Win32 Windows 5.3.1 Feb 23 2000}
IDL> .COMPILE "D:\Idl readfile\Programs\ascii_io_large_test.pro"
% Compiled module: ASCII_IO_LARGE_TEST.
IDL> ascii_io_large_test
% Format fills output buffer. Re-write as multiple I/O statements.
% Execution halted at: ASCII_IO_LARGE_TEST 11 D:\Idl
readfile\Programs\ascii_io_large_test.pro
% $MAIN$
----------------------------------------------------------
"Martin Downing" <martin.downing@ntlworld.com> wrote in message
news:ojzD7.29678$GA.3999822@news2-win.server.ntlworld.com...
> Isa,
> I cant reproduce your problem,
> here is the output I get from the code below which does outpur/input of
> 12500 floats in one line
> print, !version
>
> { x86 Win32 Windows Microsoft Windows 5.5 Beta Jun 20 2001 32 64}
>
> IDL> ascii_io_large_test
> values read incorrectly = 0
> line length read = 100000
>
>
> regards
>
> Martin
>
> =================================
> pro ascii_io_large_test
>
> fn = !fpaths.tmp + "aio_test.txt"
>
> ; create output
> a = findgen(12500)/1000
>
> ; write test file
> openw, lun, fn, /get_lun, width = 500000L
> ; write two lines worth
> printf, lun, a,format='(12500F8.3)'
> printf, lun, a, format='(12500F8.3)'
> close, lun
>
> ; define input variables
> b= fltarr(12500)
> line = ""
>
> ; read test file
> openr, lun, fn, /get_lun;, width = 10000L
> readf,lun,format='(12500F8.3)',b
> readf,lun,line
> close , lun
>
> ; analyse data
> ids = where(a ne b, count)
> print, "values read incorrectly =", count
> print,"line length read =", strlen(line)
>
> end
> =================================
> --
> ----------------------------------------
> Martin Downing,
> Clinical Research Physicist,
> Grampian Orthopaedic RSA Research Centre,
> Woodend Hospital, Aberdeen, AB15 6LS.
>
> "Isa Usman" <I.Usman@rl.ac.uk> wrote in message
> news:9rma6a$gbk@newton.cc.rl.ac.uk...
>> Hello,
>>
>> I am trying to read a single row from a large file. The amout of numbers
> per
>> row is about 12500. So in IDL i have the following lines;
>>
>> readf,lun,format='(500F8.3)',ch1_val_s
>>
>> so that i only read 500 values at a time and it gives me the error;
>>
>> % Input line is too long for input buffer of 32767 characters.
>>
>> From what i can gather, IDL is trying to read the whole line first
before
> it
>> puts it into the array. Can anybody suggest a way round this please.
>>
>> Thanks
>>
>> Isa Usman
>>
>>
>>
>
>
>
>
|
|
|