How to use the pykrige.core function in PyKrige

To help you get started, we’ve selected a few PyKrige 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 bsmurphy / PyKrige / tests / test_core.py View on Github external
def test_core_adjust_for_anisotropy():

    X = np.array([[1.0, 0.0, -1.0, 0.0], [0.0, 1.0, 0.0, -1.0]]).T
    X_adj = core._adjust_for_anisotropy(X, [0.0, 0.0], [2.0], [90.0])
    assert_allclose(X_adj[:, 0], np.array([0.0, 1.0, 0.0, -1.0]), **allclose_pars)
    assert_allclose(X_adj[:, 1], np.array([-2.0, 0.0, 2.0, 0.0]), **allclose_pars)
github bsmurphy / PyKrige / tests / test_core.py View on Github external
),
    )
    assert ss[2, 5] <= 1e-15
    assert not np.allclose(ss, 0.0)

    z, ss = core._krige(
        np.vstack((data[:, 0], data[:, 1])).T,
        data[:, 2],
        np.array([1.0, 1.0]),
        variogram_models.linear_variogram_model,
        [1.0, 1.0],
        "euclidean",
    )
    assert z == approx(2.0)
    assert ss == approx(0.0)
    z, ss = core._krige(
        np.vstack((data[:, 0], data[:, 1])).T,
        data[:, 2],
        np.array([1.0, 2.0]),
        variogram_models.linear_variogram_model,
        [1.0, 1.0],
        "euclidean",
    )
    assert ss != approx(0.0)

    data = np.zeros((50, 3))
    x, y = np.meshgrid(np.arange(0.0, 10.0, 1.0), np.arange(0.0, 10.0, 2.0))
    data[:, 0] = np.ravel(x)
    data[:, 1] = np.ravel(y)
    data[:, 2] = np.ravel(x) * np.ravel(y)
    ok = OrdinaryKriging(
        data[:, 0],
github bsmurphy / PyKrige / pykrige / ok.py View on Github external
)
                print("Range:", self.variogram_model_parameters[1])
                print("Nugget:", self.variogram_model_parameters[2], "\n")
        if self.enable_plotting:
            self.display_variogram_model()

        if self.verbose:
            print("Calculating statistics on variogram model fit...")
        self.delta, self.sigma, self.epsilon = _find_statistics(
            np.vstack((self.X_ADJUSTED, self.Y_ADJUSTED)).T,
            self.Z,
            self.variogram_function,
            self.variogram_model_parameters,
            self.coordinates_type,
        )
        self.Q1 = core.calcQ1(self.epsilon)
        self.Q2 = core.calcQ2(self.epsilon)
        self.cR = core.calc_cR(self.Q2, self.sigma)
        if self.verbose:
            print("Q1 =", self.Q1)
            print("Q2 =", self.Q2)
            print("cR =", self.cR, "\n")
github bsmurphy / PyKrige / pykrige / ok.py View on Github external
print("Range:", self.variogram_model_parameters[1])
                print("Nugget:", self.variogram_model_parameters[2], "\n")
        if self.enable_plotting:
            self.display_variogram_model()

        if self.verbose:
            print("Calculating statistics on variogram model fit...")
        if enable_statistics:
            self.delta, self.sigma, self.epsilon = _find_statistics(
                np.vstack((self.X_ADJUSTED, self.Y_ADJUSTED)).T,
                self.Z,
                self.variogram_function,
                self.variogram_model_parameters,
                self.coordinates_type,
            )
            self.Q1 = core.calcQ1(self.epsilon)
            self.Q2 = core.calcQ2(self.epsilon)
            self.cR = core.calc_cR(self.Q2, self.sigma)
            if self.verbose:
                print("Q1 =", self.Q1)
                print("Q2 =", self.Q2)
                print("cR =", self.cR, "\n")
        else:
            self.delta, self.sigma, self.epsilon, self.Q1, self.Q2, self.cR = [None] * 6
github bsmurphy / PyKrige / pykrige / ok3d.py View on Github external
)
                print("Range:", self.variogram_model_parameters[1])
                print("Nugget:", self.variogram_model_parameters[2], "\n")
        if self.enable_plotting:
            self.display_variogram_model()

        if self.verbose:
            print("Calculating statistics on variogram model fit...")
        self.delta, self.sigma, self.epsilon = _find_statistics(
            np.vstack((self.X_ADJUSTED, self.Y_ADJUSTED, self.Z_ADJUSTED)).T,
            self.VALUES,
            self.variogram_function,
            self.variogram_model_parameters,
            "euclidean",
        )
        self.Q1 = core.calcQ1(self.epsilon)
        self.Q2 = core.calcQ2(self.epsilon)
        self.cR = core.calc_cR(self.Q2, self.sigma)
        if self.verbose:
            print("Q1 =", self.Q1)
            print("Q2 =", self.Q2)
            print("cR =", self.cR, "\n")
github bsmurphy / PyKrige / pykrige / uk.py View on Github external
)
                print("Range:", self.variogram_model_parameters[1])
                print("Nugget:", self.variogram_model_parameters[2], "\n")
        if self.enable_plotting:
            self.display_variogram_model()

        if self.verbose:
            print("Calculating statistics on variogram model fit...")
        self.delta, self.sigma, self.epsilon = _find_statistics(
            np.vstack((self.X_ADJUSTED, self.Y_ADJUSTED)).T,
            self.Z,
            self.variogram_function,
            self.variogram_model_parameters,
            "euclidean",
        )
        self.Q1 = core.calcQ1(self.epsilon)
        self.Q2 = core.calcQ2(self.epsilon)
        self.cR = core.calc_cR(self.Q2, self.sigma)
        if self.verbose:
            print("Q1 =", self.Q1)
            print("Q2 =", self.Q2)
            print("cR =", self.cR, "\n")

        if self.verbose:
            print("Initializing drift terms...")

        # Note that the regional linear drift values will be based
        # on the adjusted coordinate system, Really, it doesn't actually
        # matter which coordinate system is used here.
        if "regional_linear" in drift_terms:
            self.regional_linear_drift = True
            if self.verbose:
github bsmurphy / PyKrige / pykrige / uk.py View on Github external
print("Nugget:", self.variogram_model_parameters[2], "\n")
        if self.enable_plotting:
            self.display_variogram_model()

        if self.verbose:
            print("Calculating statistics on variogram model fit...")
        self.delta, self.sigma, self.epsilon = _find_statistics(
            np.vstack((self.X_ADJUSTED, self.Y_ADJUSTED)).T,
            self.Z,
            self.variogram_function,
            self.variogram_model_parameters,
            "euclidean",
        )
        self.Q1 = core.calcQ1(self.epsilon)
        self.Q2 = core.calcQ2(self.epsilon)
        self.cR = core.calc_cR(self.Q2, self.sigma)
        if self.verbose:
            print("Q1 =", self.Q1)
            print("Q2 =", self.Q2)
            print("cR =", self.cR, "\n")
github bsmurphy / PyKrige / pykrige / ok3d.py View on Github external
print("Nugget:", self.variogram_model_parameters[2], "\n")
        if self.enable_plotting:
            self.display_variogram_model()

        if self.verbose:
            print("Calculating statistics on variogram model fit...")
        self.delta, self.sigma, self.epsilon = _find_statistics(
            np.vstack((self.X_ADJUSTED, self.Y_ADJUSTED, self.Z_ADJUSTED)).T,
            self.VALUES,
            self.variogram_function,
            self.variogram_model_parameters,
            "euclidean",
        )
        self.Q1 = core.calcQ1(self.epsilon)
        self.Q2 = core.calcQ2(self.epsilon)
        self.cR = core.calc_cR(self.Q2, self.sigma)
        if self.verbose:
            print("Q1 =", self.Q1)
            print("Q2 =", self.Q2)
            print("cR =", self.cR, "\n")
github bsmurphy / PyKrige / pykrige / uk3d.py View on Github external
)
                print("Range:", self.variogram_model_parameters[1])
                print("Nugget:", self.variogram_model_parameters[2], "\n")
        if self.enable_plotting:
            self.display_variogram_model()

        if self.verbose:
            print("Calculating statistics on variogram model fit...")
        self.delta, self.sigma, self.epsilon = _find_statistics(
            np.vstack((self.X_ADJUSTED, self.Y_ADJUSTED, self.Z_ADJUSTED)).T,
            self.VALUES,
            self.variogram_function,
            self.variogram_model_parameters,
            "euclidean",
        )
        self.Q1 = core.calcQ1(self.epsilon)
        self.Q2 = core.calcQ2(self.epsilon)
        self.cR = core.calc_cR(self.Q2, self.sigma)
        if self.verbose:
            print("Q1 =", self.Q1)
            print("Q2 =", self.Q2)
            print("cR =", self.cR, "\n")

        if self.verbose:
            print("Initializing drift terms...")

        # Note that the regional linear drift values will be based on the
        # adjusted coordinate system. Really, it doesn't actually matter
        # which coordinate system is used here.
        if "regional_linear" in drift_terms:
            self.regional_linear_drift = True
            if self.verbose: