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

Home » Public Forums » archive » swap_endian breaks on double
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
swap_endian breaks on double [message #6125] Tue, 23 April 1996 00:00 Go to next message
Philippe Peeters is currently offline  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 Go to previous message
Rolando Raqueno is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Memory allocation problem using Call_external
Next Topic: Re: Parameter Passing - Error in doc ?

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

Current Time: Wed Oct 08 13:42:25 PDT 2025

Total time taken to generate the page: 0.00455 seconds