anchor.diff:              ng_local = 1_ip
           end if
   
  +        ! Check if x is increasing and evenly spaced
  +        gsi%even_x_spacing = .true.
  +        dx = (x(size(x)) - x(1) ) / (size(x) - 1.0_dp)
           do i = 1, (size(x, kind=ip)-1)
               if(x(i+1) <= x(i)) then
                   write(log_output_unit, *) "x must be increasing", x
                   call generic_stop
               end if
  -        end do
  +            if( abs(x(i+1) - x(i) - dx) > 10*maxval(spacing([dx, x(i:i+1)])) ) gsi%even_x_spacing = .false.
  +        end do
  +
  +        ! Check if y is increasing and evenly spaced
  +        gsi%even_y_spacing = .true.
  +        dy = (y(size(y)) - y(1) ) / (size(y) - 1.0_dp)
           do i = 1, (size(y, kind=ip)-1)
               if(y(i+1) <= y(i)) then
                   write(log_output_unit, *) "y must be increasing", y
                   call generic_stop
               end if
  +            if( abs(y(i+1) - y(i) - dy) > 10*maxval(spacing([dy, y(i:i+1)])) ) gsi%even_y_spacing = .false.
           end do
   
           ! Grid size
  
positive.code:             !! Size of the third dimension of gsi%g1, gsi%g2
  
          integer(ip) :: i, ng_local
  
          ! By default assume third dimension of gsi%g1, gsi%g2 has size 1
          if(present(ng)) then
  
negative.code:         real(dp) :: xs(10), ys(20), time, dt, start_time
          real(dp) :: dx, dy, x0, y0
          integer(ip), parameter :: ng = 2
          integer(ip) :: i, j, k, testcase
          real(dp) :: tx(5), ty(5), tv(5,ng), test_grid(10, 20, ng)
          real(dp) :: errtol
          type(c_ptr) :: grid_update_context
  