Re: transfering data files [message #16636] |
Tue, 10 August 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Kenneth Mankoff (mankoff@nagik.cs.colorado.edu) writes:
> Next question: (which i can figure out with a little trial and
> error)... If the files are created (fully) on the Intel laptop, is the
> swap_endian keyword still needed?
> What happens if i have a file transfered from the Sun to the Dell
> (i.e. /swap_endian needed to open it), and i update _only part of the
> file_ with an OPENU command. Will the file now still be in "big endian",
> or will the SUN part of the file be "big" and the updated Intel part of
> the file be "little"?
Yikes! I wouldn't be doing that. :-(
As long as you are opening the files up anyway,
take my advice and write them out using the XDR
format. Then you can completely forget about
byte order and you can update any part or all
of the file as you wish. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: transfering data files [message #16641 is a reply to message #16636] |
Tue, 10 August 1999 00:00  |
Kenneth Mankoff
Messages: 42 Registered: August 1999
|
Member |
|
|
Thank you. The /swap_endian keyword works, and solves everthing (for this
problem, at least).
Next question: (which i can figure out with a little trial and
error)... If the files are created (fully) on the Intel laptop, is the
swap_endian keyword still needed?
What happens if i have a file transfered from the Sun to the Dell
(i.e. /swap_endian needed to open it), and i update _only part of the
file_ with an OPENU command. Will the file now still be in "big endian",
or will the SUN part of the file be "big" and the updated Intel part of
the file be "little"?
-=ken=-
On Mon, 9 Aug 1999, David Fanning wrote:
> Kenneth Mankoff (mankoff@nagik.cs.colorado.edu) writes:
>
>> I need to transfer idl ".dat" files between computers. One is a Sun
>> running solaris, the other is a Dell laptop running Linux. The sun has
>> IDL5.2, Linux is running IDL5.1. The files are corrupted when transfered,
>> unless i copy them to .sav files. Is there any way around this?
>
> I'm presuming that by "dat" files you mean "binary" files.
> If so, the files aren't corrupted, the machines you want
> to read the files on using different byte ordering. Hence,
> binary files are not portable on these machines. See
> this article:
>
> http://www.dfanning.com/tips/endian_machines.html
>
> One solution to this problem is to open the files up
> on the machine they were created on, and save the files
> as XDR binary files. (Use the XDR keyword on the OPENW
> statement.) Then read the XDR files on the other machine.
>
> Another solution is to read the data in the normal way,
> but then byte swap it to the correct format. You can use
> the BYTEORDER function for this.
>
> Still another solution is to open the file on the machine
> you want to get the data into with the SWAP_ENDIAN keyword
> set on the OPENR statement.
>
> Any (or all) of these methods should help "uncorrupt"
> the file. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
>
>
|
|
|
Re: transfering data files [message #16652 is a reply to message #16636] |
Mon, 09 August 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Kenneth Mankoff (mankoff@nagik.cs.colorado.edu) writes:
> I need to transfer idl ".dat" files between computers. One is a Sun
> running solaris, the other is a Dell laptop running Linux. The sun has
> IDL5.2, Linux is running IDL5.1. The files are corrupted when transfered,
> unless i copy them to .sav files. Is there any way around this?
I'm presuming that by "dat" files you mean "binary" files.
If so, the files aren't corrupted, the machines you want
to read the files on using different byte ordering. Hence,
binary files are not portable on these machines. See
this article:
http://www.dfanning.com/tips/endian_machines.html
One solution to this problem is to open the files up
on the machine they were created on, and save the files
as XDR binary files. (Use the XDR keyword on the OPENW
statement.) Then read the XDR files on the other machine.
Another solution is to read the data in the normal way,
but then byte swap it to the correct format. You can use
the BYTEORDER function for this.
Still another solution is to open the file on the machine
you want to get the data into with the SWAP_ENDIAN keyword
set on the OPENR statement.
Any (or all) of these methods should help "uncorrupt"
the file. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: transfering data files [message #16653 is a reply to message #16652] |
Mon, 09 August 1999 00:00  |
Andy Loughe
Messages: 174 Registered: November 1995
|
Senior Member |
|
|
Kenneth Mankoff wrote:
>
> Hi everyone,
> I need to transfer idl ".dat" files between computers. One is a Sun
> running solaris, the other is a Dell laptop running Linux. The sun has
> IDL5.2, Linux is running IDL5.1. The files are corrupted when transfered,
> unless i copy them to .sav files. Is there any way around this?
>
> thanks,
> ken.
How were these .dat files created?
Is this an endian-ness issue?
Maybe swap_endian would help.
Does it help to set /xdr in the openr statement?
openr, iu, file, /get_lun, xdr=1
--
Andrew F. Loughe | email: afl@cdc.noaa.gov
NOAA-CIRES CDC Mail Code: R/E/CD1 | www :
http://www.cdc.noaa.gov/~afl
325 Broadway | voice: (303)497-6211
Boulder, CO 80303-3328 | fax : (303)497-7013
------------------------------------------------------------ ---------------
"I do not feel obliged to believe that the same God who has endowed us
with
sense, reason, and intellect has intended us to forego their use."
-Galileo
|
|
|