      SUBROUTINE vrtpsl(SI,SL,LVL,SIGMA)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C                .      .    .                                       .
C SUBPROGRAM:    VRTPSL      COMPUTE LAYER SIGMA/ETA FROM INTERFACES
C   PRGMMR: DIMEGO           ORG: W/NMC22    DATE: 88-03-31
C
C ABSTRACT: COMPUTES THE SIGMA VALUES FOR LAYERS FROM THE
C   BRACKETTING SIGMA VALUES AT INTERFACES
C
C PROGRAM HISTORY LOG:
C   83-03-31  HOKE
C   88-06-30  DIMEGO      DOCBLOCK HALF /  FTN200
C   90-10-24  DIMEGO      added SIGMA argument and 
C                         logic for mean ETA in layer
C
C USAGE:    CALL VRTPSL(SI,SL,LVL,SIGMA)
C   INPUT ARGUMENT LIST:
C     SI       - ARRAY OF INTERFACE SIGMA/ETA VALUES
C              - NORMALLY DECREASING FROM 1.0 TO 0.
C              - IF FIRST VALUE > 1 SI CONTAINS PRESSURES
C              - WHICH ARE TRANSFERRED DIRECTLY TO SL
C     LVL      - NUMBER OF LAYERS CONTAINED IN SI ARRAY
C     SIGMA    - LOGICAL switch for SIGMA vs ETA
C
C   OUTPUT ARGUMENT LIST:
C     SL       - ARRAY OF LVL MID-POINT SIGMA/ETA VALUES
C
C REMARKS:  CANNOT USE V OPTION OF FTN200 COMPILER
C
C ATTRIBUTES:
C   LANGUAGE: standard FORTRAN
C   MACHINE:  
C
C$$$
      IMPLICIT REAL (A-H,O-Z)
      LOGICAL SIGMA
      DIMENSION PI( 99 ),PP( 99 ),PIB( 99 )
      DIMENSION PSIG( 99 ),SL( 99 ),SI( 99 )
C-------   FIRST WE TEST VALUE SI(1) FOR PRESSURES (MB)
      IF( SI(1).GT.1.00 ) GO TO 10
      IF( SIGMA ) THEN
      LVLP1 = LVL + 1
      CP = 1005.0
      R = 287.05
      ROCP = R / CP
      CPOR = CP / R
      PSFC = 1013.25
      PP(LVLP1) = 0.
      DO 1 K = 1,LVL
      PP(K) = PSFC * SI(K)
    1 CONTINUE
      ONEKAP = 1.0 + ROCP
      DO 2 K = 1,LVLP1
      PI(K) = PP(K)**ONEKAP
    2 CONTINUE
      DO 3 K = 1,LVL
      PIB(K) = (PI(K) - PI(K+1))/(ONEKAP*(PP(K) - PP(K+1)))
    3 CONTINUE
      DO 4 K = 1,LVL
      PSIG(K) = PIB(K)**CPOR
    4 CONTINUE
      DO 5 K = 1,LVL
      SL(K) = PSIG(K)/PSFC
    5 CONTINUE
      RETURN
      ELSE
C   simple mean value in layer for ETA
      DO 6 K = 1,LVL
        SL(K) = 0.5*(SI(K)+SI(K+1))
    6 CONTINUE
      RETURN
      END IF
   10 CONTINUE
      DO 15 K = 1,LVL
      SL(K) = SI(K)
   15 CONTINUE
      RETURN
      END
