      SUBROUTINE CMPBR(NBRAMA, NBRHIR, NBRAMB)
      IMPLICIT NONE
C*********************************************************************
C
C   NAME- CMPBR
C
C   LANGUAGE- FORTRAN 77     TYPE- SUBROUTINE      COMPUTER- CRAY  
C
C   VERSION- 1.0  DATE- 11/16/93   PROGRAMMER- ARTHUR B. YANG (SMSRC)
C   VERSION- 2.0  DATE- 09/08/94   PROGRAMMER- SURYA JANDHYALA (SMSRC)
C     ATOVS-44  CHANGED MSU AND SSU VALUES TO AMSU-A AND AMSU-B
C               VALUES.
C   VERSION- 3.0  DATE- 01/21/96   PROGRAMMER- ALEX POZDNYAK (FDC)     
C     MODIFIED TO RUN ON THE CRAY.  REPLACED I*4 WITH INT.
C 
C   FUNCTION- CMPBR COMPUTES THE TOTAL NUMBER OF BAD RADIANCES
C             FOR EACH CHANNEL OF THE AMSU-A, HIRS, AND AMSU-B
C             INSTRUMENTS.
C
C
C   CALLING SEQUENCE PARAMETERS-
C
C     ARGUMENT  TYPE  I/O                   DESCRIPTION
C     --------  ----  ---   ------------------------------------------
C     NBRAMA    INT   I/O   ARRAY CONTAINING THE BAD RADIANCES FOR
C                           THE AMSU-A(DIM 28 X 15).
C
C     NBRHIR    INT   I/O   ARRAY CONTAINING THE BAD RADIANCES FOR
C                           THE HIRS(DIM 28 X 20).
C
C     NBRAMB    INT   I/O   ARRAY CONTAINING THE BAD RADIANCES FOR
C                           THE AMSU-B(DIM 28 X 5).
C
C
C
C
C   LOCAL PARAMETERS-
C
C     ARGUMENT  TYPE  I/O                   DESCRIPTION
C     --------  ----  ---   ------------------------------------------
C     HIRSUM    INT         SUM OF BAD RADIANCES FOR THE HIRS.
C
C     I         INT         DO-LOOP INDEX.
C
C     J         INT         DO-LOOP INDEX.
C
C     AMASUM    INT         SUM OF BAD RADIANCES FOR THE AMSU-A.
C
C     AMBSUM    INT         SUM OF BAD RADIANCES FOR THE AMSU-B.
C
C   EXIT STATES-  NONE.
C
C   ASSUMPTIONS-  1. THAT THE DATA LOCATED INSIDE THE CALLING
C                    ARGUMENTS HAS BEEN ORIENTED (COLUMNS REPRESENT
C                    CHANNELS AND ROWS REPRESENT FRAMES) PROPERLY.
C
C                 2. THE NUMBER OF BAD RADIANCE VALUES FOR EACH OF THE
C                    INSTRUMENTS IS AN INTEGER VALUE.  THE ARRAYS:
C                    NBRAMA, NBRAMB AND NBRHIR; ARE INITIALIZED TO
C                    ZEROS IN THE ROUTINE INIMON.
C**********************************************************************
C
      INTEGER   NBRAMA(28,15), NBRHIR(28,20), NBRAMB(28,5)
      INTEGER   AMASUM, HIRSUM, AMBSUM, I, J
C
      DO 10 J = 1, 20
C
C...INITIALIZE ACCUMULATORS.
C
          AMASUM = 0
          HIRSUM = 0
          AMBSUM = 0
C
C...THE NUMBER OF HIRS BAD RETRIEVALS IS STORED IN AN ARRAY WITH
C   TWENTY-EIGHT ROWS AND TWENTY COLUMNS. SUM THE COLUMNS FROM
C   NUMBERS ONE THRU TWENTY, EVENTHOUGH IN THE SUBPROGRAM STATS,
C   ONLY THE VALUES ONE THRU NINETEEN WILL BE USED.
C
          DO 20 I = 1, 28
              HIRSUM = HIRSUM + NBRHIR(I, J)
   20     CONTINUE
          NBRHIR(28,J) = HIRSUM
C
C...THE NUMBER OF AMSU-A BAD RETRIEVALS IS STORED IN AN ARRAY WITH
C   TWENTY-EIGHT ROWS AND FIFTEEN COLUMNS. SUM THE COLUMNS FROM
C   NUMBERS ONE THRU FIFTEEN.
C
          IF (J.LE.15) THEN
              DO 30 I = 1, 28
                  AMASUM = AMASUM + NBRAMA(I, J)
   30         CONTINUE
              NBRAMA(28,J) = AMASUM
          ENDIF
C
C...THE NUMBER OF AMSU-B BAD RETRIEVALS IS STORED IN AN ARRAY WITH
C   TWENTY-EIGHT ROWS AND FIVE COLUMNS. SUM THE COLUMNS FROM           0
C   NUMBERS ONE THRU FIVE.                                             0
C
          IF (J.LE.5) THEN
              DO 40 I = 1, 28
                  AMBSUM = AMBSUM + NBRAMB(I,J)
   40         CONTINUE
              NBRAMB(28,J) = AMBSUM
          ENDIF
   10 CONTINUE
C
      RETURN
      END
