      SUBROUTINE CARAP2(A,PH,  COEF,LNT,KIND) 
C 
C     * CCRN APR 23/81 - R.LAPRISE. 
C     * CONVERT A COMPLEX ARRAY COEF OF LENGTH LNT FROM CARTESIAN 
C     * (REAL,IMAG.) TO POLAR FORM (AMPL.,PHASE). 
C     * IF KIND = 4H DEG, THE PHASE ANGLE IS RETURNED IN DEGREES, 
C     * OTHERWISE IS IT IN RADIANS. THE PHASE IS NORMALIZED TO LIE
C     * IN THE INTERVAL 0(INCL.) TO 2PI(EXCL.). 
C 
C     * LEVEL 2,COEF
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      COMPLEX COEF(LNT) 
      REAL A(LNT),PH(LNT) 
C 
      DATA PI/3.1415926535898E0/
C-----------------------------------------------------------------------
      DO 100 L=1,LNT
      A(L)=ABS(COEF(L))
      PH(L)=0.E0
      IF(A(L).EQ.0.E0) GO TO 100
      PH(L)=ATAN2(- IMAG(COEF(L)),REAL(COEF(L)))
      IF(PH(L).LT.0.E0) PH(L)=PH(L)+2.E0*PI 
      IF(KIND.EQ.NC4TO8(" DEG")) PH(L)=PH(L)*180.E0/PI
  100 CONTINUE
      RETURN
      END 
