How to use the pyinterp.core.trivariate_float64 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 / core / test_trivariate.py View on Github external
def _test(self, interpolator, filename):
        """Testing an interpolation method."""
        grid = self.load_data()
        lon = np.arange(-180, 180, 1 / 3.0) + 1 / 3.0
        lat = np.arange(-90, 90, 1 / 3.0) + 1 / 3.0
        time = 898500 + 3
        x, y, t = np.meshgrid(lon, lat, time, indexing="ij")
        z0 = core.trivariate_float64(grid,
                                     x.flatten(),
                                     y.flatten(),
                                     t.flatten(),
                                     interpolator,
                                     num_threads=0)
        z1 = core.trivariate_float64(grid,
                                     x.flatten(),
                                     y.flatten(),
                                     t.flatten(),
                                     interpolator,
                                     num_threads=1)
        shape = (len(lon), len(lat))
        z0 = np.ma.fix_invalid(z0)
        z1 = np.ma.fix_invalid(z1)
        self.assertTrue(np.all(z1 == z0))
        if HAVE_PLT:
            plot(x.reshape(shape), y.reshape(shape), z0.reshape(shape),
                 filename)
        return z0
github CNES / pangeo-pyinterp / tests / core / test_trivariate.py View on Github external
def _test(self, interpolator, filename):
        """Testing an interpolation method."""
        grid = self.load_data()
        lon = np.arange(-180, 180, 1 / 3.0) + 1 / 3.0
        lat = np.arange(-90, 90, 1 / 3.0) + 1 / 3.0
        time = 898500 + 3
        x, y, t = np.meshgrid(lon, lat, time, indexing="ij")
        z0 = core.trivariate_float64(grid,
                                     x.flatten(),
                                     y.flatten(),
                                     t.flatten(),
                                     interpolator,
                                     num_threads=0)
        z1 = core.trivariate_float64(grid,
                                     x.flatten(),
                                     y.flatten(),
                                     t.flatten(),
                                     interpolator,
                                     num_threads=1)
        shape = (len(lon), len(lat))
        z0 = np.ma.fix_invalid(z0)
        z1 = np.ma.fix_invalid(z1)
        self.assertTrue(np.all(z1 == z0))
        if HAVE_PLT:
github CNES / pangeo-pyinterp / tests / core / test_trivariate.py View on Github external
def test_grid3d_bounds_error(self):
        """Test of the detection on interpolation outside bounds"""
        grid = self.load_data()
        interpolator = core.Bilinear3D()
        lon = np.arange(-180, 180, 1 / 3.0) + 1 / 3.0
        lat = np.arange(-90, 90 + 1, 1 / 3.0) + 1 / 3.0
        time = 898500 + 3
        x, y, t = np.meshgrid(lon, lat, time, indexing="ij")
        core.trivariate_float64(grid,
                                x.flatten(),
                                y.flatten(),
                                t.flatten(),
                                interpolator,
                                num_threads=0)
        with self.assertRaises(ValueError):
            core.trivariate_float64(grid,
                                    x.flatten(),
                                    y.flatten(),
                                    t.flatten(),
                                    interpolator,
                                    bounds_error=True,
                                    num_threads=0)
github CNES / pangeo-pyinterp / tests / core / test_trivariate.py View on Github external
def test_grid3d_bounds_error(self):
        """Test of the detection on interpolation outside bounds"""
        grid = self.load_data()
        interpolator = core.Bilinear3D()
        lon = np.arange(-180, 180, 1 / 3.0) + 1 / 3.0
        lat = np.arange(-90, 90 + 1, 1 / 3.0) + 1 / 3.0
        time = 898500 + 3
        x, y, t = np.meshgrid(lon, lat, time, indexing="ij")
        core.trivariate_float64(grid,
                                x.flatten(),
                                y.flatten(),
                                t.flatten(),
                                interpolator,
                                num_threads=0)
        with self.assertRaises(ValueError):
            core.trivariate_float64(grid,
                                    x.flatten(),
                                    y.flatten(),
                                    t.flatten(),
                                    interpolator,
                                    bounds_error=True,
                                    num_threads=0)