 
 	CUDA_CHECK(cudaMalloc((float**)&d_Tpot, N * sizeof(float)));
 	CUDA_CHECK(cudaMalloc((float**)&d_MR, N * sizeof(float)));
+	CUDA_CHECK(cudaMalloc((float**)&d_prevTpot, N * sizeof(float)));
+	CUDA_CHECK(cudaMalloc((float**)&d_prevMR, N * sizeof(float)));
+	CUDA_CHECK(cudaMalloc((float**)&d_meanTpot, N * sizeof(float)));
+	CUDA_CHECK(cudaMalloc((float**)&d_meanMR, N * sizeof(float)));
+	CUDA_CHECK(cudaMalloc((float**)&d_range, N * sizeof(float)));
 	CUDA_CHECK(cudaMalloc((float**)&d_T, N * sizeof(float)));
 	CUDA_CHECK(cudaMalloc((float**)&d_RH, N * sizeof(float)));
 	CUDA_CHECK(cudaMalloc((float**)&d_P, N * sizeof(float)));
 	CUDA_CHECK(cudaMalloc((float**)&d_TD, N * sizeof(float)));
 
-	InitializeArray<float>(d_Tpot, himan::MissingFloat(), N, stream);
-	InitializeArray<float>(d_MR, himan::MissingFloat(), N, stream);
-
-	std::vector<float> Tpot(N, himan::MissingFloat());
-	std::vector<float> MR(N, himan::MissingFloat());
-
-	CUDA_CHECK(cudaHostRegister(reinterpret_cast<void*>(Tpot.data()), sizeof(float) * N, 0));
-	CUDA_CHECK(cudaHostRegister(reinterpret_cast<void*>(MR.data()), sizeof(float) * N, 0));
+	InitializeArray<float>(d_meanTpot, 0.f, N, stream);
+	InitializeArray<float>(d_meanMR, 0.f, N, stream);
+	InitializeArray<float>(d_range, 0.f, N, stream);
 
 	const auto& Psample = std::get<0>(sourceData);
 	const auto& Tsample = std::get<1>(sourceData);

	}
}

cape_multi_source cape_cuda::GetNHighestThetaEValuesGPU(const std::shared_ptr<const plugin_configuration>& conf,
                                                        std::shared_ptr<info<float>> myTargetInfo, int n)
{

		ASSERT((P > 100 && P < 1500) || IsMissing(P));
		ASSERT((RH >= 0 && RH < 102) || IsMissing(RH));

		d_Tpot[idx] = metutil::Theta_<float>(T, 100 * P);
		d_MR[idx] = metutil::smarttool::MixingRatio_<float>(T, RH, 100 * P);
	}
}

