! subroutine mklatbnd(xnew,xold,nx,isign,iprint) ! ! Use data in xold(nx) and return data xnew(nx). ! If isign < 0, change sign. ! This is generally used to make boundary latitudes across poles, ! e.g. make lat 0 from lat 1: ! call mklatbnd(tmplon_old,h_old%data(:,1,k,n),h_old%nlon, ! isign), where isign < 0 for velocity vectors. ! ! Args: integer,intent(in) :: nx,isign,iprint real,intent(in) :: xold(nx) real,intent(out) :: xnew(nx) ! ! Local: integer :: i,ii,lim real :: sign if (iprint > 0) | write(6,"('mklatbnd: nx=',i4,' xold(:)=',/,(6e12.4))") | nx,xold(:) sign = 1. if (isign < 0) sign = -1. ii = nx/2+1 lim = nx/2+2 if (sign==-1.) then do i=1,lim xnew(ii+2) = -xold(i+2) xnew(i) = -xold(ii) if (iprint > 0) | write(6,"('isign=',i3,' nx=',i4,' lim=',i4,' i=',i4,' ii=', | i4,' xnew(ii+2)=',e12.4,' xnew(i)=',e12.4)") isign,nx, | lim,i,ii,xnew(ii+2),xnew(i) ii = ii+1 enddo else do i=1,lim xnew(ii+2) = xold(i+2) xnew(i) = xold(ii) if (iprint > 0) | write(6,"('isign=',i3,' nx=',i4,' lim=',i4,' i=',i4,' ii=', | i4,' xnew(ii+2)=',e12.4,' xnew(i)=',e12.4)") isign,nx, | lim,i,ii,xnew(ii+2),xnew(i) ii = ii+1 enddo endif if (iprint > 0) | write(6,"('mklatbnd: xnew=',/,(6e12.4))") xnew(:) end subroutine mklatbnd