CMAX: [Version 1.0 (6/22/93)]
CMAX: ----------------------------------------------------
CMAX: Transformation of AVGUVINC from avguvinc.f
CMAX: ----------------------------------------------------
C......................................................................
C                                                                     .
C  Program:    AVGUVINC                                               .
C  Language:   FORTRAN V (ANSI-77 STANDARD)                           .
C  Computer:   CRAY YMP 4/832                                         .
C                                                                     .
C  Programmer: J. Pfaendtner                                          .
C  Date:       Spring, 1990                                           .
C......................................................................
      SUBROUTINE avguvinc_v1(im,clam,os,ln,slam,os100,ln100,unp,vnp,usp,
     &    vsp)
C  AVERAGES A VECTOR FIELD AT THE NORTH AND SOUTH POLES
cmax: Changed argument CLAM to passed with index
      INTEGER os
      INTEGER ln
cmax: Changed argument SLAM to passed with index
      INTEGER os100
      INTEGER ln100
      DIMENSION clam(1-os+1:ln+1-os)
      INTEGER I
      INTEGER IM
      DIMENSION slam(1-os100+1:ln100+1-os100)
C     REAL              UBAR
      DIMENSION UNP (IM)
      DIMENSION USP (IM)
C     REAL              VBAR
      DIMENSION VNP (IM)
      DIMENSION VSP (IM)
!hpf$ distribute clam(block)
!hpf$ distribute slam(block)
!hpf$ distribute unp(block)
!hpf$ distribute usp(block)
!hpf$ distribute vnp(block)
!hpf$ distribute vsp(block)
C  NORTH POLE
      ubar = 0.0
      vbar = 0.0
      DO i = 1 , im
        ubar = ubar + (unp(i) * clam(i) - vnp(i) * slam(i))
      ENDDO
      DO i = 1 , im
        vbar = vbar + (vnp(i) * clam(i) + unp(i) * slam(i))
      ENDDO
      ubar = ubar / im
      vbar = vbar / im
      DO i = 1 , im
        unp(i) = ubar * clam(i) + vbar * slam(i)
      ENDDO
      DO i = 1 , im
        vnp(i) = vbar * clam(i) - ubar * slam(i)
      ENDDO
C     SOUTH POLE
      ubar = 0.0
      vbar = 0.0
      DO i = 1 , im
        ubar = ubar + (usp(i) * clam(i) + vsp(i) * slam(i))
      ENDDO
      DO i = 1 , im
        vbar = vbar + (vsp(i) * clam(i) - usp(i) * slam(i))
      ENDDO
      ubar = ubar / im
      vbar = vbar / im
      DO i = 1 , im
        usp(i) = ubar * clam(i) - vbar * slam(i)
      ENDDO
      DO i = 1 , im
        vsp(i) = vbar * clam(i) + ubar * slam(i)
      ENDDO
      RETURN
      END
