anchor.diff:                      uk=min(k,ny)
                       vi=min(i,nx)
                       top=min(j+1,nz)
  +					if (top==j) then
  +						bottom=j-1
  +					else
  +						bottom=j
  +					endif
                       
                       dpos=1
                       curdir=calc_direction(domain%u(i,j,uk), domain%v(vi,j,k))
  
positive.code:         
          ! allocate the (LARGE) look up tables for both U and V
          if (reverse) then
              allocate(rev_u_LUT(n_dir_values,n_nsq_values,nxu,nz,ny))
              allocate(rev_v_LUT(n_dir_values,n_nsq_values,nx,nz,nyv))
              u_LUT=>rev_u_LUT
              v_LUT=>rev_v_LUT
          else
              allocate(hi_u_LUT(n_dir_values,n_nsq_values,nxu,nz,ny))
              allocate(hi_v_LUT(n_dir_values,n_nsq_values,nx,nz,nyv))
              u_LUT=>hi_u_LUT
              v_LUT=>hi_v_LUT
          endif
  
negative.code:         if (.not.allocated(dir_values)) then
              allocate(dir_values(n_dir_values))
              allocate(nsq_values(n_nsq_values))
              allocate(spd_values(n_spd_values))
          endif
          do i=1,n_dir_values
              dir_values(i)=(i-1)/real(n_dir_values-1) * (dirmax-dirmin) + dirmin
          enddo
          do i=1,n_spd_values
              spd_values(i)=(i-1)/real(n_spd_values-1) * (spdmax-spdmin) + spdmin
          enddo
          do i=1,n_nsq_values
              nsq_values(i)=(i-1)/real(n_nsq_values-1) * (nsqmax-nsqmin) + nsqmin
  