      SUBROUTINE POLARC(L,CBUF,AMP,PHZ)
C     POLARC COMPUTES THE POLAR COORDINATES FROM RECTANGULAR COORDINATES.
C
C ARGUMENTS:
C L    - THE NUMBER OF COORDINATES TO CONVERT.
C        THE NUMBER OF COMPLEX PAIRS IN ARRAY CBUF.
C CBUF  - AN ARRAY OF COMPLEX RECTANGULAR COORDINATES.
C AMP  - THE ARRAY OF AMPLITUDE COMPONENTS CALCULATED BY POLAR.
C PHZ  - THE ARRAY OF PHASES CALCULATED.
C
C   TAKEN FROM ENDERS ROBINSON'S BOOK "MULTICHANNEL TIME SERIES ANALYSIS
C  WITH DIGITAL COMPUTER PROGRAMS": HOLDEN-DAY, 1967, SAN FRANSISCO.
C
c  mod 1 Apr 10 - remove arithmetic IF statements
c
      DIMENSION CBUF(1),AMP(L),PHZ(L)
      COMPLEX CBUF
      PI=3.14159265
      DO 110 I=1,L
      RE=REAL(CBUF(I))
      XIM=AIMAG(CBUF(I))
      AMP(I)=SQRT(RE*RE+XIM*XIM)
c      IF(XIM) 10,20,30
      IF( xim .EQ. 0 ) GOTO 20
      IF( xim .GT. 0 ) GOTO 30
c10    IF(RE) 40,50,60
      IF( re .LT. 0 ) GOTO 40
      IF( re .EQ. 0 ) GOTO 50
      IF( re .GT. 0 ) GOTO 60
c20    IF(RE) 70,80,60
20    IF( re .LT. 0 ) GOTO 70
      IF( re .EQ. 0 ) GOTO 80
      IF( re .GT. 0 ) GOTO 60
c30    IF(RE) 90,100,60
30    IF( re .LT. 0 ) GOTO 90
      IF( re .EQ. 0 ) GOTO 100
      IF( re .GT. 0 ) GOTO 60
40    PHZ(I)=ATAN(XIM/RE)-PI
      GO TO 110
50    PHZ(I)=-PI/2.
      GO TO 110
60    PHZ(I)=ATAN(XIM/RE)
      GO TO 110
70    PHZ(I)=-PI
      GO TO 110
80    PHZ(I)=0.
      GO TO 110
90    PHZ(I)=ATAN(XIM/RE)+PI
      GO TO 110
100   PHZ(I)=PI/2.
110   CONTINUE
      RETURN
      END
