Re: Byte Swapping [message #37025 is a reply to message #37023] |
Thu, 20 November 2003 14:35   |
bc25
Messages: 1 Registered: November 2003
|
Junior Member |
|
|
mwatson@met.fsu.edu (Mike W) wrote in message news:<eb94e153.0311201151.428e6819@posting.google.com>...
> I have a large set of data that apparently was created on a little
> endian platform. I am working on a big endian platform and cannot get
> the data to read in correctly. These are my commands:
>
> brr=fltarr(1090,820)
> byteorder,brr,/swap_if_big_endian
> openr,1,'ndvi0006.d'
> readu,1,brr
> close,1
>
> and i get this error message:
>
> % READU: End of file encountered. Unit: 1, File: ndvi0006.d
> % Execution halted at: $MAIN$
>
> The data is not read correctly and is also very important when I do
> convert the data. I should get values in the array from -1 to 1. The
> negative values seem to be OK but the positive values are much too
> large. The data works fine when it was read on a little endian machine
> so that is why I assumed that this is the byte order of the data. Any
> help would be greatly appreciated.
>
> -Mike Watson
> -Florida State University
You may want to try:
brr=fltarr(1090,820)
openr,inunit,fname,/GET_LUN,/SWAP_IF_BIG_ENDIAN
readu,inunit,brr
FREE_LUN,inunit
This works for me on Mac, Unix and PC reading data written by a PC.
|
|
|