N7CRAT.TXT -   Format of Nimbus 7 RAT C Tape Series data.


                  OVERALL STRUCTURE
                  -----------------

*       Files are copies of original NIMBUS 7 SAMS C series tapes.

*       Each block has the following structure:

     (  Record 1:       Length of record in bytes          (2 bytes)
     (                  Record serial number in "file"     (2 bytes)
     (                  Block identifier                   (2 bytes)
Block(                  Data                    (length<65532 bytes)
     (  Record 2:       Ditto
     (  .
     (  .
     (  Record N:       Ditto

*       The byte ordering within 16 bit integers follows the DEC
        convention of least significant byte first.

Block identification
--------------------

7200    File header
7201    Data header
7202    Major frame data
7203    Temperature data


FILE HEADER  (variable length) 
-----------

Word
  -1       7200              (2 bytes indicating this is "file" header)
   0     "File" # on tape  (2 bytes)
   1     Year
   2     Day
   3     7201            ) List of data types in this "file"
         7202            ) terminated by zero.
         7203            )
         0               )
         Checksum


DATA HEADER (258 16 BIT INTEGERS)
-----------

Word
 -1     7201    Identifier
0-3     System flags
  4     Header number (1st day=1, 2nd=2 etc, thus 0 implies no data)
5-9     Reserved for system
------------------
 10     Orbit #         (as received)
 11     Segment #       ( "   " )
 12     True orbit #
13-16   Start time of data ( year, day, secs(2))
17-20   Fiish   "   "   "   (  "     "     " )
21-24   Time of reception ( "     "     " )
25-28   Time and longitude of last equator crossing going north
        (day, secs(2), long)
29-32   "    "      "      "    "       "       "    south ("  "  "  ")
33-36   Time and latitude of last day / night crossing (day, secs(2), lat)
37-40   "     "     "      " night / day    " ( "  "  "  ")
------------------
(Statistics on day)
41      Length (number of major frames)
42      Number of checksum errors on transmission
43        "     "    "        "    " mag tape
44        "     " sync errors
45        "     " verification readouts
46      Length of CDA file (number of blocks containing calibration information)
47,48   Mode at start of day
49,50   Mode at end of day
51      Lat/long error flag (no of secs wrong if >100)
-------------------
52      No of eigen coefficients used in retrieval
53      No of temperature sublevels used in retrieval
54      Nominal data year of this sub block of data
55         "     "   day  "    "   "   "    "   "
56      PMC daily mean temperatures (deg*100)   (7 words)
63      PMC daily mean pressures (mb*100)       (7 words)
70      PMC daily mean periods (counts)         (7 words)
77      Flag to indicate data should have limited processing
78-208  [Spare]
209     Version number x 10 of receiving and unformatting program
210     Version number of data format (as indicated by first number in appendix)
211-255 Event table used in phase 1 plots (in pairs [major frame no, character])
256     Checksum


Mode words:
----------

First word:  first byte=PMC mode,
             lowest 3 bits of second byte= power/launch/standby
second word: PCL prog no in first 4 bits, + PMC sieve setting(10 bits)

PMC mode byte is packed as follows:
        : C1 : B12 : C2 : A3 : C3 : A4 : -- : A12 :             0=on, 1=off
PMC sieve settings are packed into the lowest 10 bits as follows
        : C3 : C2 : C1 - C1 : B12 - B12 : A4 : A3 : A12 - A12 :



MAJOR FRAME DATA (386 16 BIT INTEGERS)
----------------

WORD    FUNCTION
----------------

-1      7202                            Identifier
0       Format/Mark #                   2 bytes: Format=data type;
                                                 Mark=Format generation number
1       Error flags                     See note (1)

2       Year
3       Day
4,5     Time (secs)
6       Latitude                        (*100 degrees)
7       Longitude                       ( " ")
8       Altitude                        (km)
9       Lat of tangent point            (*100 degrees)
10      Long "   "      "                 "     "    
11      Flags(3 words)                  See note (2)
14      Black body temperature          (deg c * 100)
15      Chopper temperature             (deg c * 100)
16      Digital B                       See note (3)
22      Spacecraft status

27      Channel identification          (4 bytes * 9 channels) See note (4)
45      Radiances                       (8 words *12 slots)    See note (5)
141     Estimated errors in radiances   (12 words)              "

153     PMC pressures                   (7 words) see note (6)
160     PMC cell temperatures           (7 words) (deg c *100) see note (6)

167     Azimuth position                (8 words, degrees*1000)
175     LVDT (degrees rel datum *1000)  (8 words)
183     Roll angle (ch D at step 40)    (8 words) (deg * 1000)
191     H (Tangent ht of chan D)        (8 words) (km*100 from ref lev at 7 sh)
199     Tangent scale ht of a chans     (8 words) (scale ht * 1000) See note (7)
207     Tangent scale ht of b chans     (8 words)       "       "
215     Tangent scale ht of c chans     (8 words)       "       "
223     Est. error on ZTs               (8 words)       "       "
231     Roll angle derived by retrev    (8 words - deg * 10000)
239     Estimated error in above        (   "     "   )
247     ACS roll fine error             (8 words)
255     Terminator height at tangent point (km * 100 above ellipsoid)
256     Yaw                             (16 bytes)
264     Pitch                           (16 bytes)
272     Radiances                       (A1P, A1W, A234P, A234W)
304     Radiances                       (B2P, B2W, C1P, C1W, C23P, C23W)
352     PMC periods                     (7 words)
359     PMC amplitudes                  (7 words)
366     Chopper amplitude
367     Sieve temperatures              (7 words)
374     Chopper temperature expanded
375     A234, B1, A1, C1 detector temp  (4 words)
379     B1, A234 det. dc level          (2 words)
381     M1, M2 mirror temperature       (2 words)
383     SEU temperature 'A'
384     Checksum


NOTES
-----

(1) Error flags
---------------

   BIT  0= Checksum on transmission            ) For first seven 2 second
        1= Checksum on reading mag tape        ) readouts
        2,3= Sync loss & sync slip summary bits)
        4= Checksum on transmission            ) For last one 2 second
        5= Checksum on reading mag tape        ) readout
        6,7= Sync loss & sync slip summary bits
        14= Forced end of orbit
        15= End of orbit flag detected (i.e. last but one word of raw
             block was 5252 octal (2730 decimal) or 6453 octal (3371 decimal)).

(2) Flag words
--------------

   11   Non zero if data all bad
        BIT 0: Launch mode
        BIT 1: Standby mode
        BIT 2: Power off
        BIT 3: Memory verify
   12   BITS 0-2: PCL program identifier
   13   BITS 0-7: BIT I will be set if sample I is an internal black body view
        BITS 8-15: BIT I+8 will be set if there is some doubt that PMC(I)
                   is changing

(3) Digital B
-------------

    1/1 sample will occupy 1 16 bit word. The remaining 3/16 samples will be
    arranged as 5 groups of 3 bits per 16 bit word and 1 spare bit.

The earliest of the 3 or 16 samples is the one corresponding to the most
significant bit position.

OFFSET  BITS    FUNCTION #    NAME                      BIT =(1/0)
-------------------------------------------------------------------------------
0       0-15    12018         Azimuth forward sector    yes/no
1       0-15    12019         Azimuth backward sector   yes/no
2       12-14   12001         Power                     on/off
        9-11    12002         Limb scan drive           on/off
        6-8     12003         Azimuth scan drive        on/off
        3-5     12004         Launch mode               on/off
        0-2     12005         PCL                       auto/manual
3       12-14   12006         PCL memory                verify/normal
        9-11    12007         PCL                       MemoryB/MemoryA
        6-8     12008         Cooler door               shut/open
        3-5     12009         Upper limb scan limit     yes/no
        0-2     12010         Low limb scan limit       yes/no
4       12-14   12011         Forward azimuth sc.lim.   yes/no
        9-11    12012         Backwards azimuth sc.lim. yes/no
        6-8     12013         Black body out of fov     yes/no
        3-5     12014         Black body in fov         yes/no
        0-2     12015         Serial data cmd           ena/dis
5       12-14   12016         Standby mode              yes/no
        9-11    12017         PCL busy                  yes/no
        6-8     12020         A 2/3/4 heater            on/off
        3-5     12021         B1 gain                   low/high
        0-2       -           Spare
-------------------------------------------------------------------------------

(4) Channel identification
--------------------------

Consists of 4 bytes of data for each of 9 channels in the order
27:A1, 29:A2, 31:A3, 33:A4, 35:B1, 37:B2, 39:C1, 41:C2, 43:C3.

BYTE 0                  PMR data quality flag
BYTE 1                  WB data quality flag
BYTE 2                  Sieve setting
BYTE 3  BITS 0-3        Pointer to PMR data
BYTE 3  BITS 4-7        Pointer to WB data

Bit 0 is LSB. The data quality flag bytes contain 1 bit for each observation;
Bit 0 corresponds to the 1st sample in the frame. "1" is bad, "0" is good.
The quality checks for PMR and WB data are independent.

If there is no data at all in the channel, the data pointer will be set to 15
(all 4 bits set); otherwise the 8 radiances will be found at word
45 + 8*(p-1) onwards in the frame, where p is the pointer.

Grounds for rejection of data/ setting of channel id bits
---------------------------------------------------------
In the following table the program performing the check and setting the flag
bits is also indicated.

Bad:    * frame flag (word 11) non zero                 (QUAL)
        * modulator off, or other modulator interfering (QUAL)
        * A2/3/4 cooler door not open, or heater on     (QUAL)
        * more than 4 steps since last sample           (QUAL) 
        * BB in in/out transient                        (CALIB2)
        * B1 gain changing                              (QUAL)
        * Azimuth mirror in fast slew mode +
        * suspect data during internal black body view  (CALIB2)

Suspect:* modulator on but run up +
        * sieve temp not settled +
        * PMC temp not stable +
        * A2/3/4 detector too warm                      (CALIB2) 
        * Internal black body view                      (CALIB2)
          (If this data wanted, check flag word 2)

+ not yet implemented.

Bad radiances will be set to -9999. Suspect radiances will be left.
Note. In the case of wideband channels several pointers may be indicating
the same data ie those channels which share the same detector.

Channel ID
----------

27      A1
29      A2
31      A3
33      A4
35      B1
37      B2
39      C1
41      C2
43      C3

(5) Radiances (These are the present locations in the block)
-------------

45      A1   PMR
53      A1   WB
61      A234 PMR
69      A234 WB
77      B1   PMR
85      B1   WB
93      B2   PMR
101     B2   WB
109     C1   PMR
117     C1   WB
125     C23  PMR
133     C23  WB

Scaling of radiances determined by format number (high byte of word 0 of data).
If format number>8 then A1P, sieve 0 and 1;
                        B2P, sieve 0 and 1;
                        A234P, all sieves -
                                             % 290 K black body x 10.
                        All other channels - % 290 K black body x 100.
otherwise
                        A234P, all sieves  - % 290 K black body x 10
                        all other channels - % 290 K black body x 100.



(6) Position in block of specific cell temperatures, etc.:
----------------------------------------------------------

modulator       period          amplitude       cell temp       pressure
---------       ------          ---------       ---------       --------
A12             215             223             160             153
A3              216             224             161             154
A4              217             225             162             155
B12             218             226             163             156
C1              219             227             164             157
C2              220             228             165             158
C3              221             229             166             159
Chopper         222             230              15             N/A
Black body      N/A             N/A              14             N/A

(7) Tangent scale heights are set to      9999          before 25:FEB:82
                                        -32768          after  25:FEB:82
 if they are outside the atmosphere.


TEMPERATURE BLOCK (386 16 BIT INTEGERS)
-----------------

WORD            FUNCTION
------------------------

-1              7203            IDENTIFIER
0               Lat ref no (1 is 50S, 48 is 67.5N). Range 1-48
1,2             Time secs
3               Day
4               Year
5               Sat. lat. deg.*100
6               Sat. long. deg.*100
7               Tang. pt. lat. deg.*100
8               Tang. pt. long. deg.*100
9               major frame in cal file corresponding to this frame

10-             NOE words; eigen function coeffs *10000
10+NOE -        NOE words; std dev. in above *10000
10+2*NOE        NR words; temperature (k) at each special level; *10
10+2*NOE+NR -   NR words; relative error at each special level; *10000
10+2*NOE+2*NR - NR words; temperature std dev (deg k*10). 
                (note differs from .lt1 item).
10+2*NOE+3*NR - 72 words; absolute temperature at intervals of 0.2 in log(p)
                          from 1.4 upwards. k *10.
10+2*NOE+3*NR+72 - 127  zero (spare space)
127-383         2 further blocks as above (0-126)
384             Checksum

Currently NR=10 and NOE=8 (check words 52,53 of header block)