NOAA Polar Orbiter Data User's GuideAppendix B |
Introduction Page, NOAA POD Guide TOC, AcronymsThis appendix describes a user procedure for unpacking five channel LAC/HRPT data received on CCTs from SSB. This procedure can be readily adapted to selected channel format LAC/HRPT data or GAC data.
As described in Section 3.2, LAC/HRPT data are written on tape as two physical records per scan. Each scan contains data from all five channels plus Earth location and calibration information. The data are 10-bit samples. Data from the 5 channels are interleaved, i.e., the first data sample in the scan is from Channel 1, the next from Channel 2, then Channel 3, Channel 4, and Channel 5, with this sequence repeating through the scan. The 10-bit data samples are packed three to a four-byte (8 bits/byte) group (i.e., three to a 32-bit word).
The unpacking procedure described below unpacks the data and rearranges it so that data from the same channel are collected together and stored in sequence (i.e., all of the data for Channel 1 followed by all of the data for Channel 2, etc.). Thus, the original five channel scan is sorted into five consecutive single channel scan lines. The individual 10-bit data samples are also unpacked and stored in consecutive pairs of bytes (or 16-bit words, or 32-bit halfwords). Access to Earth location and calibration information is also provided.
The procedure will be outlined in a sequence of steps:
CALL UNPK10(ISCAN(113),IBUF,3414)
where ISCAN(113) is the start of the HRPT data in ISCAN, IBUF is a temporary buffer for the unpacked but still interleaved data samples, and 3414 is the number of 32-bit elements of ISCAN from each of which UNPK10 will extract three data samples (and store them in three 16-bit elements of IBUF).
DO m I = 1,5 (5 Channels) K = I DO m J = 1,2048 (2048 Samples/Channel) IDATA(J,I) = IBUF(K) m K = K + 5
In the case of two channel selected data (i.e., where the user has specified that data from only two designated channels were to be provided) UNPK10 is not used because the data samples have already been unpacked into 16-bit elements. In the case of either one or two channel selected data, the references to the calibration and Earth location information are as shown.
In the case of five channel GAC data, the procedure may be used as shown with changes for the record length and position and amount of the Earth location information.
A listing of UNPK10 follows:
SUBROUTINE UNPK10(ISCAN,IBUF,N)
DIMENSION ISCAN(3700), IBUF(10242)
DATA MASK1/Z3FF00000/
DATA MASK2/Z000FFC00/
DATA MASK3/Z000003FF/
J = 0
DO 10 I = 1,N
IWORD = ISCAN(I)
J = J + 1
JWORD = LAND(IWORD,MASK1)
IBUF(J) = SHIFTR(JWORD,20)
J = J + 1
JWORD = LAND(IWORD,MASK2)
IBUF(J) = SHIFTR(JWORD,10)
J = J + 1
IBUF(J) = LAND(IWORD,MASK3)
10 CONTINUE
RETURN
END
The arrays used in UNPK10 are defined as follows: ISCAN is the
input Earth scan buffer, 3700 @ 32-bit elements for LAC/HRPT. IBUF
is the output buffer for unpacked data elements, 10242 @ 16-bit
elements for LAC/HRPT. N is the number of elements of ISCAN to be
unpacked, 3414 for LAC/HRPT.
MASK1 is a 32-bit mask with ones set in the 10-bit positions of the first 10-bit data sample in a 32-bit element of ISCAN. MASK2 and MASK3 are the same for the second and third data samples.
The function LAND(A,B) performs a logical "AND" on A and B, with the result left in A. The effect in this routine of the use of LAND and the MASK is to zero all bits in IWORD except those of the data sample specified by the MASK, thus isolating it.
The function SHIFTR(A,N) performs a right shift of the contents of A by N places, and is equivalent to a division of A by 2N. The purpose of UNPK10 is to right justify the isolated data sample in IWORD, preparatory to moving it to the output buffer IBUF.
UNPK10 proceeds through the input scan buffer, unpacking the words one by one and storing in IBUF the three data samples obtained from each input element, until the entire input scan has been processed.
| Previous Section | Top of Page | Next Section |