How to use the pyinterp.bicubic 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_interpolator.py View on Github external
grid.bicubic(collections.OrderedDict(lon=x.flatten(),
                                                 lat=y.flatten()),
                         bounds_error=True,
                         boundary="sym")

        x_axis = pyinterp.Axis(np.linspace(-180, 179, 360), is_circle=True)
        y_axis = pyinterp.Axis(np.linspace(-90, 90, 181), is_circle=False)
        z_axis = pyinterp.Axis(np.linspace(0, 10, 10), is_circle=False)
        matrix, _ = np.meshgrid(x_axis[:], y_axis[:])
        grid = pyinterp.Grid2D(x_axis, y_axis, matrix.T)

        self.assertIsInstance(grid, pyinterp.Grid2D)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten(), fitting_model='_')
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten(), boundary='_')
        grid = pyinterp.Grid2D(x_axis.flip(inplace=False), y_axis, matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        grid = pyinterp.Grid2D(x_axis, y_axis.flip(), matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        matrix, _, _ = np.meshgrid(x_axis[:], y_axis[:], z_axis[:])
        grid = pyinterp.Grid3D(x_axis, y_axis, z_axis,
                               matrix.transpose(1, 0, 2))
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())
github CNES / pangeo-pyinterp / tests / test_interpolator.py View on Github external
z_axis = pyinterp.Axis(np.linspace(0, 10, 10), is_circle=False)
        matrix, _ = np.meshgrid(x_axis[:], y_axis[:])
        grid = pyinterp.Grid2D(x_axis, y_axis, matrix.T)

        self.assertIsInstance(grid, pyinterp.Grid2D)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten(), fitting_model='_')
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten(), boundary='_')
        grid = pyinterp.Grid2D(x_axis.flip(inplace=False), y_axis, matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        grid = pyinterp.Grid2D(x_axis, y_axis.flip(), matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        matrix, _, _ = np.meshgrid(x_axis[:], y_axis[:], z_axis[:])
        grid = pyinterp.Grid3D(x_axis, y_axis, z_axis,
                               matrix.transpose(1, 0, 2))
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())
github CNES / pangeo-pyinterp / tests / test_interpolator.py View on Github external
pyinterp.bicubic(grid, x.flatten(), y.flatten(), fitting_model='_')
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten(), boundary='_')
        grid = pyinterp.Grid2D(x_axis.flip(inplace=False), y_axis, matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        grid = pyinterp.Grid2D(x_axis, y_axis.flip(), matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        matrix, _, _ = np.meshgrid(x_axis[:], y_axis[:], z_axis[:])
        grid = pyinterp.Grid3D(x_axis, y_axis, z_axis,
                               matrix.transpose(1, 0, 2))
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())
github CNES / pangeo-pyinterp / tests / test_interpolator.py View on Github external
with self.assertRaises(ValueError):
            grid.bicubic(collections.OrderedDict(lon=x.flatten(),
                                                 lat=y.flatten()),
                         bounds_error=True,
                         boundary="sym")

        x_axis = pyinterp.Axis(np.linspace(-180, 179, 360), is_circle=True)
        y_axis = pyinterp.Axis(np.linspace(-90, 90, 181), is_circle=False)
        z_axis = pyinterp.Axis(np.linspace(0, 10, 10), is_circle=False)
        matrix, _ = np.meshgrid(x_axis[:], y_axis[:])
        grid = pyinterp.Grid2D(x_axis, y_axis, matrix.T)

        self.assertIsInstance(grid, pyinterp.Grid2D)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten(), fitting_model='_')
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten(), boundary='_')
        grid = pyinterp.Grid2D(x_axis.flip(inplace=False), y_axis, matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        grid = pyinterp.Grid2D(x_axis, y_axis.flip(), matrix.T)
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())

        matrix, _, _ = np.meshgrid(x_axis[:], y_axis[:], z_axis[:])
        grid = pyinterp.Grid3D(x_axis, y_axis, z_axis,
                               matrix.transpose(1, 0, 2))
        with self.assertRaises(ValueError):
            pyinterp.bicubic(grid, x.flatten(), y.flatten())