anchor.diff:              vhat=l*ineta
   
   !           pull it back out of fourier space. 
  -! 			plan = fftw_plan_dft_2d(nx,ny, what,w_hat, FFTW_BACKWARD,FFTW_ESTIMATE)
  -! 			call fftw_execute_dft(plan, what,w_hat)
  -! 			call fftw_destroy_plan(plan)
   			
   ! 			it should be possible to store the plan and execute it everytime rather than recreating it everytime, doesn't matter too much 
               plan = fftw_plan_dft_2d(ny,nx, uhat,u_hat, FFTW_BACKWARD,FFTW_ESTIMATE)
  
positive.code: 	        allocate(v_hat(nx,ny))
  	        allocate(m(nx,ny))
  	        allocate(msq(nx,ny))
  	        allocate(ineta(nx,ny))
          
  	!         # % Compute 2D k and l wavenumber fields (could be stored in options or domain or something)
  
negative.code: 		real, dimension(:,:),allocatable :: real_terrain
  		integer::nx,ny,i,pos
  		real::weight
  		nx=size(terrain,1)+buffer*2
  		ny=size(terrain,2)+buffer*2
  		allocate(buffer_topo(nx,ny))
  		buffer_topo=minval(terrain)
  		
  		buffer_topo(1+buffer:nx-buffer,1+buffer:ny-buffer)=terrain
  		do i=1,buffer
  			weight=i/(real(buffer)*2)
  			pos=buffer-i
  			buffer_topo(pos+1,1+buffer:ny-buffer)    =terrain(1,1:ny-buffer*2)*(1-weight)+terrain(nx-buffer*2,1:ny-buffer*2)*   weight
  			buffer_topo(nx-pos-1,1+buffer:ny-buffer) =terrain(1,1:ny-buffer*2)*(  weight)+terrain(nx-buffer*2,1:ny-buffer*2)*(1-weight)
  			buffer_topo(1+buffer:nx-buffer,pos+1)    =terrain(1:nx-buffer*2,1)*(1-weight)+terrain(1:nx-buffer*2,ny-buffer*2)*   weight
  			buffer_topo(1+buffer:nx-buffer,ny-pos-1) =terrain(1:nx-buffer*2,1)*(  weight)+terrain(1:nx-buffer*2,ny-buffer*2)*(1-weight)
  		enddo
  		print*, "There may be a problem in linear_winds-add_buffer_topo"
  ! 		clearly something isn't quiet right here...
  		buffer_topo(nx,:)=buffer_topo(nx-1,:)
  		buffer_topo(:,ny)=buffer_topo(:,ny-1)
  		allocate(real_terrain(nx,ny))
  		real_terrain=buffer_topo
  		call io_write2d("complex_terrain.nc","HGT",real_terrain)
  		deallocate(real_terrain)
  