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

Home » Public Forums » archive » READ_ASCII broken in IDL 5.3
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
READ_ASCII broken in IDL 5.3 [message #18733] Mon, 31 January 2000 00:00
Ed Santiago is currently offline  Ed Santiago
Messages: 8
Registered: January 2000
Junior Member
The 5.3 version of READ_ASCII no longer works with multi-line elements.

The problem is caused by ra_parse_d_values, which starts filling in
values at position zero for each new line.

Enclosed is a patch that demonstrates a possible fix for the problem,
although it may not be the best solution. I've forwarded a copy to RSI,
and trust that they'll implement this or an equivalent fix.

Also enclosed are a sample data file and IDL procedure that demonstrate
the problem. The procedure runs under IDL 5.2, and under IDL 5.3 with
my fix. It barfs under IDL 5.3 with its stock READ_ASCII.

Enjoy,
^E


-----------------patch-for-read_ascii.pro------------------- -------

--- read_ascii.pro.~1~ Mon Jan 31 13:36:39 2000
+++ read_ascii.pro Mon Jan 31 13:49:29 2000
@@ -466,7 +466,7 @@
;
for i=0, lines_per_record-1 do begin
ra_parse_d_values, lines[i], $
- types[anchor:anchor+num_fields[i]-1], p_vals, rec_count, $
+ types[anchor:anchor+num_fields[i]-1], p_vals[anchor:anchor+num_fields[i]-1], rec_count, $
delim_str, template.missingValue, whitespace_delimited
anchor = anchor + num_fields[i]
endfor


-----------------foo.pro------------------------------------ -------

PRO foo
t = { FOO_TEMPLATE, $ ; Structure name
version:1.0, $
DataStart:0L, $ ; Start at line 0
Delimiter:32B, $ ; Separated by spaces
MissingValue:!Values.F_NaN, $
CommentSymbol:'', $
FieldCount:[8L,1], $ ; 9 fields (on 2 lines)
FieldTypes:IntArr(9) + 3, $ ; ...most of them float
FieldNames:StrArr(9), $
FieldLocations:LonArr(9), $
FieldGroups:IndGen(9) } ; Don't group any fields

; Hardcode the field names
t.FieldNames = string(format='("field",I2.2)',IndGen(9))

d = read_ascii('foo.dat', template=t)
FOR i=0,8 DO BEGIN
tmp = where(d.(i) NE i+1, c)
IF c NE 0 THEN MESSAGE, 'Foo'
ENDFOR
END

-----------------foo.dat------------------------------------ -------
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9
1 2 3 4 5 6 7 8
9



--
Eduardo Santiago Software Type esm@nospam.lanl.gov RKBA!
[Message index]
 
Read Message
Previous Topic: read_gif on SUN
Next Topic: Postscript Output

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

Current Time: Fri Oct 10 14:09:18 PDT 2025

Total time taken to generate the page: 0.57555 seconds