 }
 
 __global__
-void Flip(double* __restrict__ arr, size_t ni, size_t nj)
+void Swap(double* __restrict__ arr, size_t ni, size_t nj)
 {
 	const int idx = blockIdx.x * blockDim.x + threadIdx.x;
 


	if (idx < nj * ni * 0.5)
	{
		size_t half = static_cast<size_t> (floor(static_cast<double>(nj/2)));

		const int i = fmod(static_cast<double> (idx), static_cast<double> (ni));
		const int j = floor(static_cast<double> (idx / ni));


	{
		// Force +x-y --> +x+y

		// This is needed because latlon coordinates are created from newbase area
		// and they are in +x+y. This also means that we have to flip the data
		// back after interpolation.

		// TODO: Do not flip the data twice, but create the grid in the correct scanning mode!
		
		size_t N = sourceInfo->size_x * sourceInfo->size_y * 0.5 ;

		int bs = 256;
		int gs = N/bs + (N % bs == 0?0:1);
		Swap <<<gs,bs,0,stream>>>(d_source, sourceInfo->size_x, sourceInfo->size_y);

		sourceInfo->j_scans_positive = true;
	}
