anchor.diff:          type(geo_look_up_table),intent(in)::geolut
           integer::i,k,l,ny,nx,localx,localy
           real::localw
  -        
  +
           nx=size(fieldout,1)
           ny=size(fieldout,2)
           ! use the geographic lookup table generated earlier to
  
positive.code:         !       yc=ny/2
          xc = lastpos%x
          yc = lastpos%y
          
          x = lo%lon(xc,yc)
          y = lo%lat(xc,yc)
          
          ! steps to take = the difference the between the current point and the input point / dx
          xstep = (lon-x)/dx
          ystep = (lat-y)/dy
          
          ! CASE 1 assume a quasi regular dx/dy and caluate new location
          !  while we need to step by more than one grid cell, iterate
          !  if the grid is highly regular, we will only iterate 1-2x, highly irregular might require more iterations
          !  in the diabolical case, this could fail? 
          !  in most cases this succeeds with a few iterations. 
          iterations = 0
          do while (((abs(xstep)>1).or.(abs(ystep)>1)).and.iterations<20)
              iterations = iterations+1
  
negative.code:         type(position) :: curpos, lastpos
          integer :: nx, ny, i, j, k, lo_nx, lo_ny
          real, dimension(4) :: lat, lon
  
          nx    = size(hi%lat,1)
          ny    = size(hi%lat,2)
          lo_nx = size(lo%lat,1)
          lo_ny = size(lo%lat,2)
  
          allocate(lo%geolut%x(4,nx,ny))
          allocate(lo%geolut%y(4,nx,ny))
          allocate(lo%geolut%w(4,nx,ny))
  
          curpos%x = 1
          curpos%y = 1
  
          do j=1,ny
              curpos%x = 1
              ! use a brute force approach to find a starting
  