How to use the pykrige.core._krige 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_krige_3d():

    # Adapted from example 3.2 from Kitanidis
    data = np.array([[9.7, 47.6, 1.0, 1.22], [43.8, 24.6, 1.0, 2.822]])
    z, ss = core._krige(
        np.vstack((data[:, 0], data[:, 1], data[:, 2])).T,
        data[:, 3],
        np.array([18.8, 67.9, 1.0]),
        variogram_models.linear_variogram_model,
        [0.006, 0.1],
        "euclidean",
    )
    assert z == approx(1.6364, rel=1e-4)
    assert ss == approx(0.4201, rel=1e-4)

    z, ss = core._krige(
        np.vstack((data[:, 0], data[:, 1], data[:, 2])).T,
        data[:, 3],
        np.array([43.8, 24.6, 1.0]),
        variogram_models.linear_variogram_model,
        [0.006, 0.1],
github bsmurphy / PyKrige / tests / test_core.py View on Github external
def test_core_krige():

    # Example 3.2 from Kitanidis
    data = np.array([[9.7, 47.6, 1.22], [43.8, 24.6, 2.822]])
    z, ss = core._krige(
        np.vstack((data[:, 0], data[:, 1])).T,
        data[:, 2],
        np.array([18.8, 67.9]),
        variogram_models.linear_variogram_model,
        [0.006, 0.1],
        "euclidean",
    )
    assert z == approx(1.6364, rel=1e-4)
    assert ss == approx(0.4201, rel=1e-4)

    z, ss = core._krige(
        np.vstack((data[:, 0], data[:, 1])).T,
        data[:, 2],
        np.array([43.8, 24.6]),
        variogram_models.linear_variogram_model,
        [0.006, 0.1],
github bsmurphy / PyKrige / tests / test_core.py View on Github external
"grid", np.arange(0.0, 1.9, 0.1), np.arange(2.1, 3.1, 0.1), backend="loop"
    )
    assert not np.any(ss <= 1e-15)
    z, ss = uk.execute(
        "masked",
        np.arange(2.5, 3.5, 0.1),
        np.arange(2.5, 3.5, 0.25),
        backend="loop",
        mask=np.asarray(
            np.meshgrid(np.arange(2.5, 3.5, 0.1), np.arange(2.5, 3.5, 0.25))[0] == 0.0
        ),
    )
    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",