swap_endian breaks on double [message #6125] |
Tue, 23 April 1996 00:00  |
Philippe Peeters
Messages: 14 Registered: April 1996
|
Junior Member |
|
|
I need to read the content of a binary file generated on a Sun (I
think). The content is quite complex and is a mixture of different
structures containing int, float, long, double and string.
I used the swap_endian function to convert from the original data to my
representation (linux on x86). Everything is fine unless the structure I
want to convert contains double data. The error message is
% Expression must be a scalar in this context: <DOUBLE Array(1)>.
% Execution halted at: SWAP_ENDIAN 55
/usr/local/rsi/idl_4/lib/swap_endian.pro
% READ_LVL1 58
/home/philp/idl/read_lvl1.pro
% $MAIN$
Just try this:
IDL> a={x:0.0,y:0,z:0.d0}
IDL> help,/str,a
** Structure <30b908>, 3 tags, length=16, refs=1:
X FLOAT 0.00000
Y INT 0
Z DOUBLE 0.0000000
IDL> b=swap_endian(a)
% Expression must be a scalar in this context: <DOUBLE Array(1)>.
% Execution halted at: SWAP_ENDIAN 55
/usr/local/rsi/idl_4/lib/swap_endian.pro
% $MAIN$
BUT:
IDL> a=dblarr(10)
IDL> help,a
A DOUBLE = Array(10)
IDL> b=swap_endian(a)
IDL>
swap_endian fails on structures containing scalar double. Why?
Philippe Peeters
------------------------------------------------------------ --------------
Belgian Institute for Space Aeronomy | Tel : +32-2-373.03.81
Institut d'Aeronomie Spatiale de Belgique| Fax : +32-2-374.84.23
3 Avenue Circulaire | Email :
Philippe.Peeters@oma.be
B-1180 Brussels, Belgium |
|
|
|
Re: swap_endian breaks on double [message #6229 is a reply to message #6125] |
Wed, 15 May 1996 00:00  |
Rolando Raqueno
Messages: 5 Registered: March 1996
|
Junior Member |
|
|
I mailed a fix to RSI which takes care of this problem and works
for the case that you posted.
a={x:0.0,y:0,z:0.d0}
You can either get it from them or I will post the correction once I
here that its OK to do so. (Copyright stuff issues).
Rolando
|
|
|