anchor.diff:                                  ( lt_data_m%v_perturb(1+buffer:fftnx-buffer,     buffer:fftny-buffer)         &
                                   + lt_data_m%v_perturb(1+buffer:fftnx-buffer,     1+buffer:fftny-buffer+1)) )) / 2
   
  -                        ! if (this_image()==3) then
  -                        !     if ((z==3).and.(i==2).and.(j==2).and.(k==2)) then
  -                        !         print*, buffer, shape(temporary_v)
  -                        !         print*, lt_data_m%v_perturb(fftnx/2, buffer+45:buffer+55)
  -                        !     endif
  -                        !
  -                        ! endif
                           call copy_data_to_remote(temporary_u, u_grids, hi_u_LUT, i,j,k, z)
                           call copy_data_to_remote(temporary_v, v_grids, hi_v_LUT, i,j,k, z)
   
  
positive.code:             return
          endif
  
          nx = size(z_top,1)
          ny = size(z_top,2)
  
          ! print*, this_image(), "minval(z_bottom), maxval(z_top)", minval(z_bottom), maxval(z_top)
  
          start_z = minval(z_bottom(2:nx-1,2:ny-1))
          end_z = maxval(z_top(2:nx-1,2:ny-1))
          ! print*, this_image(), start_z, end_z
          allocate(internal_z_top(size(lt_data%u_perturb,1),size(lt_data%u_perturb,2)), source=maxval(z_top))
          ! internal_z_top = maxval(z_top(2:nx-1,2:ny-1))
          ! internal_z_top(buffer+1:buffer+size(z_top,1)-2, buffer+1:buffer+size(z_top,2)-2) = z_top(2:nx-1,2:ny-1)
          internal_z_top(buffer:buffer+size(z_top,1)-1, buffer:buffer+size(z_top,2)-1) = z_top
  
          allocate(internal_z_bottom(size(lt_data%u_perturb,1),size(lt_data%u_perturb,2)), source=minval(z_bottom))
          ! internal_z_bottom(buffer+1:buffer+size(z_bottom,1)-2, buffer+1:buffer+size(z_bottom,2)-2) = z_bottom(2:nx-1,2:ny-1)
          internal_z_bottom(buffer:buffer+size(z_bottom,1)-1, buffer:buffer+size(z_bottom,2)-1) = z_bottom
  
          allocate(layer_count(size(lt_data%u_perturb,1), size(lt_data%u_perturb,2)))
  
negative.code:         deallocate(u1d, v1d)
          !$omp end parallel
          nsquared = exp(nsquared)
  
      end subroutine spatial_winds
  
  
  