def test_basic(self): """Test that the run_recursion method returns an iris.cube.Cube.""" edge_width = 1 alphas_x = None alphas_y = None plugin = RecursiveFilter(alpha_x=self.alpha_x, alpha_y=self.alpha_y, iterations=self.iterations) alphas_x = plugin.set_alphas(self.cube, self.alpha_x, alphas_x) alphas_y = plugin.set_alphas(self.cube, self.alpha_y, alphas_y) padded_cube = SquareNeighbourhood().pad_cube_with_halo(self.cube, edge_width, edge_width) result = plugin.run_recursion(padded_cube, alphas_x, alphas_y, self.iterations) self.assertIsInstance(result, Cube)
def test_expected_result(self): """Test that the run_recursion method returns an iris.cube.Cube.""" edge_width = 1 alphas_x = None alphas_y = None plugin = RecursiveFilter(alpha_x=self.alpha_x, alpha_y=self.alpha_y, iterations=self.iterations) alphas_x = plugin.set_alphas(self.cube, self.alpha_x, alphas_x) alphas_y = plugin.set_alphas(self.cube, self.alpha_y, alphas_y) padded_cube = SquareNeighbourhood().pad_cube_with_halo(self.cube, edge_width, edge_width) result = plugin.run_recursion(padded_cube, alphas_x, alphas_y, self.iterations) expected_result = 0.13382206 self.assertAlmostEqual(result.data[4][4], expected_result)