anchor.diff:      logical :: smooth_nsq
       logical :: using_blocked_flow
       real    :: N_squared
  +    integer :: nth_file=1
   
       !! unfortunately these have to be allocated every call because we could be calling on both the high-res
       !! domain and the low res domain (to "remove" the linear winds)
  
positive.code:                         sweight = calc_weight(spd_values, spos, nexts, curspd)
                          nweight = calc_weight(nsq_values, npos, nextn, curnsq)
  
                          ! perform linear interpolation between LUT values
                          if (k<=ny) then
                              wind_first =      nweight  * (dweight * u_LUT(spos, dpos,npos, i,j,k) + (1-dweight) * u_LUT(spos, nextd,npos, i,j,k))   &
  
negative.code:                                 domain%v(i,j,k) = domain%v(i,j,k) + v_perturbation(i,j,k) * linear_mask(min(nx,i),min(ny,k)) * (1-blocked)
                              endif
                          endif
  
                          ! if ((k==25) .and. (i>=110).and.(i<112)) then
                          !     print*, domain%u(i-1,j,k), domain%u(i,j,k), domain%u(i,j,k)-domain%u(i-1,j,k)
                          ! endif
                          ! if ((k==25) .and. (j==25) .and. (i>105) .and.(i<115)) then
                          !     print*, domain%u(i-1,j,k), domain%u(i,j,k), domain%u(i,j,k)-domain%u(i-1,j,k)
                          !     print*, domain%v(i,j,k-1), domain%v(i,j,k), domain%v(i,j,k)-domain%v(i,j,k-1)
                          !     ! print*, wind_first, wind_second, linear_update_fraction, 1-blocked, linear_mask(i,k)
                          ! endif
  
                      endif
                  end do
              end do
          end do
          call io_write("test_u_"//trim(str(nth_file))//".nc", "data", domain%u(:,:,25))
          nth_file = nth_file + 1
  
          ! $omp end do
          deallocate(u1d, v1d)
          ! $omp end parallel
      end subroutine spatial_winds
  
  
  