anchor.diff:    endif
     err = NF90_INQUIRE_DIMENSION(r%fid,ii,len=r%hgrid%eta_v)
   
  -  err = NF90_INQ_DIMID(r%fid,'xi_psi',r%hgrid%xi_psi)
  -  err = NF90_INQ_DIMID(r%fid,'eta_psi',r%hgrid%eta_psi)
  +  err = NF90_INQ_DIMID(r%fid,'xi_psi',ii)
  +  if (err.ne.NF90_NOERR) then
  +    write(*,*) 'Dimension xi_psi not found'
  +    return
  +  endif
  +  err = NF90_INQUIRE_DIMENSION(r%fid,ii,len=r%hgrid%xi_psi)
  +
  +  err = NF90_INQ_DIMID(r%fid,'eta_psi',ii)
  +  if (err.ne.NF90_NOERR) then
  +    write(*,*) 'Dimension eta_psi not found'
  +    return
  +  endif
  +  err = NF90_INQUIRE_DIMENSION(r%fid,ii,len=r%hgrid%eta_psi)
  +
   
     allocate(r%hgrid%lon_rho(r%hgrid%xi_rho, r%hgrid%eta_rho))
     allocate(r%hgrid%lat_rho(r%hgrid%xi_rho, r%hgrid%eta_rho))
  
positive.code:   allocate(r%hgrid%h(r%hgrid%xi_rho,r%hgrid%eta_rho))
    err = NF90_GET_VAR(r%fid,ii,r%hgrid%h)
    if (err.NE.NF90_NOERR) stop 'ERROR while reading h'
  
    ! ... masks
    ! ...
  
negative.code:   allocate(r%hgrid%lat_u  (r%hgrid%xi_u,   r%hgrid%eta_u))
    allocate(r%hgrid%lon_v  (r%hgrid%xi_v,   r%hgrid%eta_v))
    allocate(r%hgrid%lat_v  (r%hgrid%xi_v,   r%hgrid%eta_v))
    allocate(r%hgrid%lon_psi(r%hgrid%xi_psi, r%hgrid%eta_psi))
    allocate(r%hgrid%lat_psi(r%hgrid%xi_psi, r%hgrid%eta_psi))
  
    err = NF90_INQ_VARID(r%fid,'lon_rho',ii)
    err = NF90_GET_VAR(r%fid,ii,r%hgrid%lon_rho)
  