      SUBROUTINE MAKSO2(BT10,BT11,BT12,SO2)
C
C***********************************************************************
C
C   NAME- MAKSO2
C
C   LANGUAGE- VS FORTRAN      TYPE- SUBROUTINE      COMPUTER- CRAY J916
C
C   VERSION- 1.0     DATE- 08/26/96      PROGRAMMER-  LEAH WILSON (HSTX)
C   VERSION- 3.0     DATE- 01/29/97      PROGRAMMER-  LEAH WILSON (HSTX)
C   VERSION- 3.1     DATE- 11/30/99      PROGRAMMER-  LEAH WILSON (RAYTHEON)
C   VERSION- 4.0    DATE- 02/27/03   PROGRAMMER- Rickey Rollins (CSC)
C
C   FUNCTION- THIS SUBROUTINE COMPUTES THE SULFUR DIOXIDE CONTENT
C             GIVEN HIRS CHANNELS 10, 11, AND 12.
C   VERSION- 3.0  MODIFICATIONS FOR INCLUSION INTO ATOVS (DONE IN
C                 CONJUNCTION WITH RTOVS UPGRADES INTO ATOVS).
C   VERSION- 3.1  ADD CHECK FOR ZERO BRIGHTNESS TEMPERATURES.
C   VERSION- 4.0    DATE- 02/27/03   PROGRAMMER- Rickey Rollins (CSC)
C        Replace R4SPV equivalence test with ISR4SPV function
C
C   CALLING SEQUENCE PARAMETERS-
C
C   NAME    TYPE  I/O    DESCRIPTION
C   ----    ----  ---    -----------
C   BT10     REAL  I     HIRS CHANNEL 10 BRIGHTNESS TEMPERATURE.
C   BT11     REAL  I     HIRS CHANNEL 11 BRIGHTNESS TEMPERATURE.
C   BT12     REAL  I     HIRS CHANNEL 12 BRIGHTNESS TEMPERATURE.
C   SO2      REAL  O     SULFUR DIOXIDE CONTENT, CALCULATED AS
C                        TEMPERATURE ANOMALY BETWEEN ESTIMATED AND
C                        MEAUSURED HIRS CHANNEL 11.
C
C   COMMOM AREA PARAMETERS - SPVAL
C
C   LOCAL VARIABLES
C   NAME      TYPE       DESCRIPTION
C   ----      ----       -----------
C   PR10,PR12 REAL      PSEUDO-RADIANCES FOR HIRS CHANNELS 10 AND 12.
C   R11A      REAL      APPROXIMATION OF A SO2-FREE HIRS CHANNEL 11.
C   T11A      REAL      HARMONIC MEAN OF PR10 AND PR12.
C
C***********************************************************************
C
      INCLUDE 'SPVAL'
      REAL BT10, BT11, BT12, PR10,PR12, R11A, T11A, SO2
      LOGICAL   ISR4SPV
C
C    IF ANY INPUT BRIGHTNESS TEMPERATURE IS MISSING, RETURN A MISSING
C    VALUE FOR S02.
C
      SO2 = R4SPV
      IF(.NOT. ISR4SPV(BT10).AND..NOT. ISR4SPV(BT11).AND..NOT. ISR4SPV(BT12) .AND.
     1   BT10.GT.0.0.AND.BT11.GT.0.0.AND.BT12.GT.0.0) THEN
C
C    COMPUTE SULFER DIOXIDE CONTENT BY COMPARING AN APPROXIMATION
C    OF A SULFER DIOXIDE-FREE CHANNEL 11 WITH THE MEASURED
C    CHANNEL 11.
C
C    COMPUTE "PSEUDO-RADIANCES" FOR CHANNELS 10 AND 12
C
         PR10 = BT10**4
         PR12 = BT12**4
C
C    APPROXIMATE A SULFER DIOXIDE-FREE CHANNEL 11 BY TAKING THE
C    HARMONIC MEAN OF THE "PSEUDO-RADIANCES" OF CHANNELS 10 AND 12.
C
         R11A = 2.0 / (1.0/PR10 + 1.0/PR12)
         T11A = SQRT(SQRT(R11A))
C
C    COMPUTE THE TEMPERATURE ANOMALY BETWEEN THE ESTIMATED CHANNEL
C    11 AND THE MEASURED CHANNEL 11.
C
         SO2 = BT11 - T11A
      ENDIF
C
      RETURN
      END
