anchor.diff:  		real, dimension(:,:),allocatable :: real_terrain
   		integer::nx,ny,i,pos
   		real::weight
  -! 		WARNING x,y dimensions are swapped this doesn't affect output but may confuse readability
  -		ny=size(terrain,1)+buffer*2
  -		nx=size(terrain,2)+buffer*2
  -		allocate(buffer_topo(ny,nx))
  +		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:ny-buffer,1+buffer:nx-buffer)=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:nx-buffer)  =terrain(1,1:nx-buffer*2)*(1-weight)+terrain(ny-buffer*2,1:nx-buffer*2)*weight
  -			buffer_topo(ny-pos-1,1+buffer:nx-buffer) =terrain(1,1:nx-buffer*2)*(weight)+terrain(ny-buffer*2,1:nx-buffer*2)*(1-weight)
  -			buffer_topo(1+buffer:ny-buffer,pos+1)  =terrain(1:ny-buffer*2,1)*(1-weight)+terrain(1:ny-buffer*2,nx-buffer*2)*weight
  -			buffer_topo(1+buffer:ny-buffer,nx-pos-1) =terrain(1:ny-buffer*2,1)*(weight)+terrain(1:ny-buffer*2,nx-buffer*2)*(1-weight)
  +			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(ny,:)=buffer_topo(ny-1,:)
  -		buffer_topo(:,nx)=buffer_topo(:,nx-1)
  -		allocate(real_terrain(ny,nx))
  +		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)
  
positive.code:             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)
  
negative.code: !         # mimag.imag=(np.sqrt(-msq)).real
  !         # m=np.where(msq>=0, (np.sign(sig)*np.sqrt(msq)).astype('complex'), mimag)
  ! 
  ! mimag=np.zeros(Nx).astype('complex')
  ! mimag.imag=(np.sqrt(-msq)).real
  ! m=np.where(msq>=0, (np.sign(sig)*np.sqrt(msq)).astype('complex'), mimag)
  
  			msq = Ndsq/denom * kl
  			mimag=0
  		    mimag=mimag+(real(sqrt(-msq))*j)
  ! 		    m=np.where(msq>=0, (np.sign(sig)*np.sqrt(msq)).astype('complex'), mimag)
              m = sqrt(msq)         ! # % vertical wave number, hydrostatic
  			where(sig<0) m=m*-1   ! equivilant to m=m*sign(sig)
      		where(real(msq)<0) m=mimag
  			
              ineta=j*domain%fzs*exp(j*m* &
  					sum(domain%z(:,z,:)-domain%z(:,1,:)+domain%dz(:,z,:)/2) &
  					/(realnx*realny))
  !             what=sig*ineta
  
  !           # with coriolis : [+/-]j*[l/k]*f
  !           uhat = (0-m)*(sig*k-j*l*f)*ineta/kl
  !           vhat = (0-m)*(sig*l+j*k*f)*ineta/kl
  !           # removed coriolis term
  