How to use the pyinterp.fill.gauss_seidel function in pyinterp

To help you get started, we’ve selected a few pyinterp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CNES / pangeo-pyinterp / tests / test_fill.py View on Github external
def test_gauss_seidel_3d(self):
        grid = self._load(True)
        _, filled0 = pyinterp.fill.gauss_seidel(grid, num_threads=0)
        self.assertEqual((filled0[:, :, 0] - filled0[:, :, 1]).mean(), 0)
github CNES / pangeo-pyinterp / tests / test_fill.py View on Github external
def test_gauss_seidel(self):
        grid = self._load()
        _, filled0 = pyinterp.fill.gauss_seidel(grid, num_threads=0)
        _, filled1 = pyinterp.fill.gauss_seidel(grid, num_threads=1)
        _, filled2 = pyinterp.fill.gauss_seidel(grid,
                                                first_guess='zero',
                                                num_threads=0)
        data = np.copy(grid.array)
        data[np.isnan(data)] = 0
        filled0[np.isnan(filled0)] = 0
        filled1[np.isnan(filled1)] = 0
        filled2[np.isnan(filled2)] = 0
        self.assertEqual((filled0 - filled1).mean(), 0)
        self.assertEqual(np.ma.fix_invalid(grid.array - filled1).mean(), 0)
        self.assertNotEqual((data - filled1).mean(), 0)
        self.assertNotEqual((filled2 - filled1).mean(), 0)

        with self.assertRaises(ValueError):
            pyinterp.fill.gauss_seidel(grid, '_')

        x_axis = pyinterp.Axis(np.linspace(-180, 180, 10), is_circle=True)
github CNES / pangeo-pyinterp / tests / test_fill.py View on Github external
def test_gauss_seidel(self):
        grid = self._load()
        _, filled0 = pyinterp.fill.gauss_seidel(grid, num_threads=0)
        _, filled1 = pyinterp.fill.gauss_seidel(grid, num_threads=1)
        _, filled2 = pyinterp.fill.gauss_seidel(grid,
                                                first_guess='zero',
                                                num_threads=0)
        data = np.copy(grid.array)
        data[np.isnan(data)] = 0
        filled0[np.isnan(filled0)] = 0
        filled1[np.isnan(filled1)] = 0
        filled2[np.isnan(filled2)] = 0
        self.assertEqual((filled0 - filled1).mean(), 0)
        self.assertEqual(np.ma.fix_invalid(grid.array - filled1).mean(), 0)
        self.assertNotEqual((data - filled1).mean(), 0)
        self.assertNotEqual((filled2 - filled1).mean(), 0)

        with self.assertRaises(ValueError):
            pyinterp.fill.gauss_seidel(grid, '_')
github CNES / pangeo-pyinterp / tests / test_fill.py View on Github external
filled0[np.isnan(filled0)] = 0
        filled1[np.isnan(filled1)] = 0
        filled2[np.isnan(filled2)] = 0
        self.assertEqual((filled0 - filled1).mean(), 0)
        self.assertEqual(np.ma.fix_invalid(grid.array - filled1).mean(), 0)
        self.assertNotEqual((data - filled1).mean(), 0)
        self.assertNotEqual((filled2 - filled1).mean(), 0)

        with self.assertRaises(ValueError):
            pyinterp.fill.gauss_seidel(grid, '_')

        x_axis = pyinterp.Axis(np.linspace(-180, 180, 10), is_circle=True)
        y_axis = pyinterp.Axis(np.linspace(-90, 90, 10), is_circle=False)
        data = np.random.rand(len(x_axis), len(y_axis))
        grid = pyinterp.Grid2D(x_axis, y_axis, data)
        _, filled0 = pyinterp.fill.gauss_seidel(grid, num_threads=0)
        self.assertIsInstance(filled0, np.ndarray)
github CNES / pangeo-pyinterp / tests / test_fill.py View on Github external
_, filled1 = pyinterp.fill.gauss_seidel(grid, num_threads=1)
        _, filled2 = pyinterp.fill.gauss_seidel(grid,
                                                first_guess='zero',
                                                num_threads=0)
        data = np.copy(grid.array)
        data[np.isnan(data)] = 0
        filled0[np.isnan(filled0)] = 0
        filled1[np.isnan(filled1)] = 0
        filled2[np.isnan(filled2)] = 0
        self.assertEqual((filled0 - filled1).mean(), 0)
        self.assertEqual(np.ma.fix_invalid(grid.array - filled1).mean(), 0)
        self.assertNotEqual((data - filled1).mean(), 0)
        self.assertNotEqual((filled2 - filled1).mean(), 0)

        with self.assertRaises(ValueError):
            pyinterp.fill.gauss_seidel(grid, '_')

        x_axis = pyinterp.Axis(np.linspace(-180, 180, 10), is_circle=True)
        y_axis = pyinterp.Axis(np.linspace(-90, 90, 10), is_circle=False)
        data = np.random.rand(len(x_axis), len(y_axis))
        grid = pyinterp.Grid2D(x_axis, y_axis, data)
        _, filled0 = pyinterp.fill.gauss_seidel(grid, num_threads=0)
        self.assertIsInstance(filled0, np.ndarray)