anchor.diff:    ! ...
     ! =========================================================================
     ! ...
  +  subroutine zdepth(S,h,z_r,z_w,dz,eta)
  +
  +  type(vsc), intent(in)               :: S
  +  real(dp), intent(in)                :: h
  +  real(dp), intent(out)               :: z_r(S%N),dz(S%N),z_w(0:S%N)
  +  real(dp), intent(in), optional      :: eta
  +
  +  ! ... Local variables
  +  ! ...
  +  integer k
  +  real(dp) cff_r,cff_w,cff1_r,cff1_w,cff2_r,cff2_w
  +  real(dp) hwater,hinv,z_w0,z_r0,zeta
  +
  +  if (present(eta)) then
  +    zeta = eta
  +  else
  +    zeta = zero
  +  endif
  +
  +  if (S%Vtransform.eq.1) then
  +
  +    z_w(0) = -h
  +    do k=1,S%N
  +      cff_r  = S%hc*(S%sc_r(k)-S%Cs_r(k))
  +      cff_w  = S%hc*(S%sc_w(k)-S%Cs_w(k))
  +      cff1_r = S%Cs_r(k)
  +      cff1_w = S%Cs_w(k)
  +      hwater = h
  +      hinv   = one / hwater
  +      z_r0   = cff_r + cff1_r*hwater
  +      z_w0   = cff_w + cff1_w*hwater
  +      z_r(k) = z_r0 + zeta*(one + z_r0*hinv)
  +      z_w(k) = z_w0 + zeta*(one + z_w0*hinv)
  +      dz(k)  = z_w(k) - z_w(k-1)
  +    enddo
  +
  +  else if (S%Vtransform.eq.2) then
  +
  +    z_w(0) = -h
  +    do k=1,S%N
  +      cff_r  = S%hc*S%sc_r(k)
  +      cff_w  = S%hc*S%sc_w(k)
  +      cff1_r = S%Cs_r(k)
  +      cff1_w = S%Cs_w(k)
  +      hwater = h
  +      hinv   = one / (S%hc + hwater)
  +      cff2_r = (cff_r + cff1_r*hwater)*hinv
  +      cff2_w = (cff_w + cff1_w*hwater)*hinv
  +      z_r(k) = zeta + (zeta + hwater)*cff2_r
  +      z_w(k) = zeta + (zeta + hwater)*cff2_w
  +      dz(k)  = z_w(k) - z_w(k-1)
  +    enddo
  +
  +  else
  +
  +    stop 'Why am I here?'
  +
  +  endif 
  +
  +  end subroutine zdepth
  +  ! ...
  +  ! =========================================================================
  +  ! ...
   
   end MODULE roms
  
positive.code: END TYPE MHgrid
  
  TYPE MVgrid
    integer                             :: N   = -1
    integer                             :: N_r = -1
    integer                             :: N_w = -1
    integer                             :: Vtransform
    integer                             :: Vstretching
    real(dp)                            :: theta_s
    real(dp)                            :: theta_b
    real(dp)                            :: Tcline
    real(dp)                            :: hc
    real(dp), dimension(:), pointer     :: s_r
    real(dp), dimension(:), pointer     :: s_w
    real(dp), dimension(:), pointer     :: Cs_r
    real(dp), dimension(:), pointer     :: Cs_w
    real(dp), dimension(:,:,:), pointer :: z0_r
    real(dp), dimension(:,:,:), pointer :: z0_w
    real(dp), dimension(:,:,:), pointer :: z_r
  
negative.code: use cdf
  
  implicit none
  
  TYPE vsc
  ! ... Vertical S-coordinate
    integer                             :: Vtransform  = 0
    integer                             :: Vstretching = 0
    integer                             :: N           = 0
    real(dp)                            :: theta_s     = 0
    real(dp)                            :: theta_b     = 0
    real(dp)                            :: Tcline      = 0
    real(dp)                            :: hc
    real(dp), dimension(:), pointer     :: sc_r
    real(dp), dimension(:), pointer     :: sc_w
    real(dp), dimension(:), pointer     :: Cs_r
    real(dp), dimension(:), pointer     :: Cs_w
  END TYPE vsc
  
  TYPE MHgrid
    integer                             :: xi_rho  = -1
  