Re: MSB, LSB? [message #14441] |
Thu, 04 March 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
David Fanning (davidf@dfanning.com) writes:
>> Height = MSB(most significant bits) * 256 + LSB(least significant bits)
Whoops! I wrote:
> height = Byte(data, 0) * 256 + Byte(data, 1)
And I probably should have written:
height = Byte(data, 1) * 256 + Byte(data, 0)
I think I wrote my test number incorrectly. :-(
You also have to pay attention to where this data was
created and what kind of machine you are working on.
For example, if this data was created on a UNIX machine
and I'm reading it on my PC, then I have to swap the
MSB and LSB when I read the data file.
OpenR, lun, filename, /Get_Lun, /Swap_If_Little_Endian
Cheers,
David
P.S. I promise in the future to get my kids off to school
BEFORE I start answering questions on the newsgroup. :-)
--
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: MSB, LSB? [message #14443 is a reply to message #14441] |
Thu, 04 March 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
������ (raptor28@net-in.co.kr) writes:
> i want to read some datas.
> its description is below.
>
> <Description of Data>
> Spatial Resolution : 3" x 3"(about 90m)
> Number of Row and Column : 1201 x 1201
> Pixel depth : 2byte
> Height Accuracy : 1m
> File Name E127n38.img : E127 - E128, N38 - N39
> File Format : unformatted binary
> Height = MSB(most significant bits) * 256 + LSB(least significant bits)
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> i can't read this data to use IDL
> how read?
OpenR, lun, thisFile, /Get_Lun
data = IntArr(1201, 1201)
ReadU, lun, data
Free_Lun, data
height = Byte(data, 0) * 256 + Byte(data, 1)
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
|
|
|