       FUNCTION PLKRAD(BTEMP,CHAN)
       IMPLICIT NONE
C***********************************************************************
C
C   NAME- PLKRAD
C
C   LANGUAGE- VS FORTRAN  TYPE- FUNCTION
C
C   VERSION- 1.0    DATE-  6/01/92   PROGRAMMER- CARLA NEIGH, SMSRC
C   VERSION- 2.0    DATE-  9/20/94   PROGRAMMER- SURYA JANDHYALA, SMSRC
C     XATOV-50 MSU AND SSU CHANNELS ARE CHANGED TO AMSU-A AND AMSU-B
C              CHANNELS. ADDED INCLUDE FILE INPARM.
C   VERSION- 3.0    DATE-  4/28/96   PROGRAMMER- TIM GARDNER (HSTX)
C   VERSION- 3.1    DATE- 10/03/96   PROGRAMMER- MIKE PETTEY (HSTX)
C   VERSION- 3.2    DATE- 04/17/98   PROGRAMMER- LEAH WILSON (RSTX)
C   VERSION- 3.3    DATE- 12/12/01   PROGRAMMER- RICKEY ROLLINS (CSC)
C
C   FUNCTION- THIS REAL FUNCTION CONVERTS A BRIGHTNESS TEMPERATURE
C             VALUE IN K TO PLANCK RADIANCE AT THE WAVE NUMBER FOR THE
C             GIVEN CHANNEL. ADDED INCLUDE FILE INPARM.
C
C   VERSION 3.0- DOCUMENTATION AND SYNTAX CHANGES FOR ATOVS BASELINE
C                ON THE CRAY
C   VERSION 3.1- CHANGES MADE DURING ATOVS OPTIMIZATION TO IMPROVE
C                THE EXECUTION TIME. SOME REDUNDANT CONDITIONAL
C                CHECKS WERE REMOVED.
C   VERSION 3.2- CHANGE CONDITIONAL TO CHECK FOR BTEMPS LT 1, RATHER
C                THAN BTEMPS EQ R4SPV
C   VERSION 3.3- Ported to IBM SP
C
C   CALLING SEQUENCE PARAMETERS-
C   NAME    TYPE   I/O   DESCRIPTION
C   ----    ----   ---   -----------
C   BTEMP    REAL   I    BRIGHTNESS TEMPERATURE IN K
C   CHAN     INT    I    CHANNEL NUMBER (OF THE SOUNDINGS INSTRUMENT
C                        CHANNELS) CORRESPONDING TO THE BRIGHTNESS
C                        TEMPERATURE VALUE:
C                        CHANNELS 1-20  = HIRS CHANNELS 1-20
C                        CHANNELS 21-35 = AMSU-A CHANNELS 1-15
C                        CHANNELS 36-40 = AMSU-B CHANNELS 1-5
C                        CHANNELS 41-42 = AVHRR CHANNELS 1-2
C                        CHANNELS 43 = AVHRR CHANNEL 3A
C                        CHANNELS 44 = AVHRR CHANNEL 3B
C                        CHANNELS 45-46 = AVHRR CHANNEL 4-5
C
C   COMMON AREA PARAMETERS- SPVAL, PLCOEF, INPARM
C
C   LOCAL VARIABLES-
C   NAME    TYPE    DESCRIPTION
C   ----    ----    -----------
C   COEFF1   REAL   PLANCK EQUATION COEFFICIENT 1
C   COEFF2   REAL   PLANCK EQUATION COEFFICIENT 2
C   SUM1     INT    TOTAL NUMBER OF HIRS AND AMSU-A CHANNELS
C   SUM2     INT    TOTAL NUMBER OF HIRS, AMSU-A, AND AMSU-B CHANNELS
C
C   FUNCTIONS USED- EXP
C
C   EXIT STATES- NONE
C
C   COMMENTS- THIS FUNCTION ASSUMES THAT VALUES HAVE BEEN PLACED IN THE
C             COMMON BLOCK /PLCOEF/
C
C***********************************************************************
C
      INTEGER CHAN
      REAL*8    BTEMP, PLKRAD

      REAL*8    COEFF1, COEFF2
      INTEGER SUM1,SUM2

      INCLUDE 'PLCOEF'
      INCLUDE 'INPARM'
      INCLUDE 'SPVAL'


C-- SET THE VALUES OF SUM1 AND SUM2

      SUM1 = HNCHAN + ANCHAN
      SUM2 = HNCHAN + ANCHAN + BNCHAN

CCLW  IF (BTEMP .NE. R4SPV) THEN
      IF (BTEMP .GT. 1.0) THEN

C-- GET THE APPROPRIATE VALUES OF THE PLANCK EQUATION COEFFICIENTS
C   FOR THE CHANNEL FROM COMMON PLCOEF

         IF (CHAN .LE. HNCHAN) THEN
            COEFF1 = C1V3H(CHAN)
            COEFF2 = C2V1H(CHAN)
         ELSE IF (CHAN .LE. SUM1) THEN
            COEFF1 = C1V3A(CHAN-HNCHAN)
            COEFF2 = C2V1A(CHAN-HNCHAN)
         ELSE IF (CHAN .LE. SUM2) THEN
            COEFF1 = C1V3B(CHAN-SUM1)
            COEFF2 = C2V1B(CHAN-SUM1)
         ELSE
            COEFF1 = C1V3G(CHAN-SUM2)
            COEFF2 = C2V1G(CHAN-SUM2)
         END IF

C-- COMPUTE THE PLANCK RADIANCE

         PLKRAD = COEFF1 / (EXP(COEFF2/BTEMP) - 1.0)

      ELSE
         PLKRAD = R4SPV
      END IF

      RETURN
      END
