Level 1B [message #11120] |
Wed, 11 March 1998 00:00 |
Kelly Dean
Messages: 92 Registered: March 1997
|
Member |
|
|
I developed a routine to unpack the 10-bit Level 1B files. I was
wondering if anyone can fiqure out a more efficient method than what I
am doing. I use a FOR loop to unpack each record into a 3-dim array (
channel, width, height ).
Any and all suggesstions welcome.
;
; Unpack 10-bit values
;
nchan = 5
nx = 2048 ; always this wide
ny = 1024 ; can be longer
dim1 = 3414 ; length of 32-bit array of video data
pack = INTarr(nchan*nx*ny) ; create array for 10-bit data
; Prepare array for index of first 10-bit word
; do not use the first 10-bit value from the last 32-bit value
index1 = LINDGEN(dim1-1) * 3
; Prepare array for index of seocnd 10-bit word
; do not use the second 10-bit value from the last 32-bit value
index2 = LINDGEN(dim1-1) * 3 + 1
; Prepare array for index of third 10-bit word
; the third 10-bit value is used from the 32-bit value
index3 = LINDGEN(dim1) * 3 + 2
; Unpacking 10 bit image data...
FOR ii = 0, NY - 1 DO BEGIN
; remove 32-bit data from data record
video = REFORM(DataRecords(ii).video, dim1)
; remove the third 10-bit values from the 32-bit values
pack(index3) = FIX(video AND '3FF'X)
; remove the second 10-bit values from the 32-bit values
pack(index2) = FIX(ISHFT(video(0:3412),-10) AND '3FF'X)
; remove the first 10-bit values from the 32-bit values
pack(index1) = FIX(ISHFT(video(0:3412),-20) AND '3FF'X)
; update pack array index for next video record.
index1 = index1 + ( 3 * dim1 ) - 2
index2 = index2 + ( 3 * dim1 ) - 2
index3 = index3 + ( 3 * dim1 ) - 2
ENDFOR
;reformat array to 3-dim ( channels, width, height )
image = REFORM(pack,nchan,nx,ny)
Kelly Dean
CSU/CIRA
|
|
|