Skip to main content

Python wrapper for a Fortran kriging and sequential Gaussian simulation engine

Project description

krigekit

PyPI Python CI

A Python wrapper for a high-performance Fortran kriging engine parallelised with OpenMP.

Capability Notes
Ordinary and simple kriging Point and block support
Co-kriging Linear Model of Coregionalisation
Universal kriging / KED External drift variables
Score transforms Normal-score / uniform quantile transforms for kriging and SGSIM
Sequential Gaussian Simulation Reproducible paths, multi-realisation
Space-time kriging Sum-metric and product-sum ST models
Multiple Indicator Kriging / SIS Categorical variables, three cross-variogram strategies
Spatially Varying Anisotropy Per-block variogram
Cross-validation Leave-one-out
Kriging weight reuse Store and replay weights

Full documentation →


Installation

pip

pip install krigekit

Pre-built binary wheels are available for:

Platform Architecture Minimum OS
Linux x86_64 manylinux_2_28 (RHEL 8 / Ubuntu 20.04 equivalent)
macOS arm64 (Apple Silicon) macOS 14 Sonoma
macOS x86_64 (Intel) macOS 15 Sequoia
Windows x86_64 Windows 10 / Server 2019

Requires Python 3.10, 3.11, or 3.12.

conda / mamba

conda-forge packaging is planned. In the meantime, install via pip inside a conda environment:

conda create -n krigekit python=3.12
conda activate krigekit
pip install krigekit

Quick start

import numpy as np
from krigekit import Kriging

obs_coord  = np.array([[0,0],[1,0],[0,1],[1,1],[0.5,0.5]], dtype=float)
obs_value  = np.array([1.0, 2.0, 3.0, 4.0, 2.5])
grid_coord = np.mgrid[0:1.1:0.25, 0:1.1:0.25].reshape(2,-1).T

k = Kriging()
k.set_obs(ivar=1, coord=obs_coord, value=obs_value)
k.set_grid(coord=grid_coord)
k.set_vgm(ivar=1, jvar=1, vtype="sph", sill=1.0, a_major=1.0)
k.set_search()
k.solve()
df = k.get_result_df()
del k

For the full class API, co-kriging, SGSIM, space-time kriging, indicator simulation, and more, see the user guide and gallery examples.


Repository structure

krigekit/
├── src/
│   ├── libkriging/      Fortran kriging engine
│   ├── sparks/          Pilot-point kriging/SGSIM CLI
│   └── krigekit/        Python ctypes wrapper
├── examples/            Sphinx-Gallery example scripts
├── tests/               pytest test suite
├── test_data/           CSV/image data used by tests and examples
├── docs/                Sphinx documentation source
├── build_lib.py         Fortran compile script
├── environment.yml      conda/mamba development environment
└── pyproject.toml       pip package configuration

Contributing

Building from source

A Fortran compiler is required (gfortran ≥ 10 or Intel ifx/ifort).

# Clone and set up the development environment
git clone https://github.com/ougx/krigekit.git
cd krigekit

# Compile the Fortran library
python build_lib.py --compiler gfortran      # Linux / macOS
python build_lib.py --compiler gfortran      # Windows (MinGW via MSYS2)
python build_lib.py --compiler ifx           # Windows (Intel oneAPI)

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

Additional build options:

python build_lib.py --opt debug        # debug build, no optimisation
python build_lib.py --no-openmp        # disable OpenMP
python build_lib.py --hcache 0         # disable factor cache

Workflow

  1. Fork the repository and create a feature branch.
  2. Add tests for any new behaviour.
  3. Run pytest to confirm all tests pass.
  4. Open a pull request.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

krigekit-0.2.4-py3-none-win_amd64.whl (807.2 kB view details)

Uploaded Python 3Windows x86-64

krigekit-0.2.4-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

krigekit-0.2.4-py3-none-macosx_15_0_x86_64.whl (2.0 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

krigekit-0.2.4-py3-none-macosx_14_0_arm64.whl (1.2 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file krigekit-0.2.4-py3-none-win_amd64.whl.

File metadata

  • Download URL: krigekit-0.2.4-py3-none-win_amd64.whl
  • Upload date:
  • Size: 807.2 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for krigekit-0.2.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ab26eb4a821a00d12908a949ceb7c37275ca0fb4ecf37bfb355d16e13e0c2cb1
MD5 3b6171a509ce46cb2053c5267c5ac55c
BLAKE2b-256 0d44b2b55237a1228ec2ed0c98e06d4abc64a28df96c0303bf91fc1f07687fdc

See more details on using hashes here.

Provenance

The following attestation bundles were made for krigekit-0.2.4-py3-none-win_amd64.whl:

Publisher: build_wheels.yml on ougx/krigekit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krigekit-0.2.4-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for krigekit-0.2.4-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9a3a6fa4cc21ee6bac4c7d251a23543bd6886d81880938a08386c9b8feb5b5b7
MD5 61e4b032f25d2a73ac77ee223e5faacd
BLAKE2b-256 fbecea48d9e12dee2c903ad55dd442de13884605e81ff215a4f0983139d3fe25

See more details on using hashes here.

Provenance

The following attestation bundles were made for krigekit-0.2.4-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on ougx/krigekit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krigekit-0.2.4-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for krigekit-0.2.4-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 5486c594fb1fd8032a32eace5e20daca46d4f2da0820fdcf5f92cbadfac745b5
MD5 5fb88f07b80c70a48b259beda94c20e1
BLAKE2b-256 a8dd6dfa694049926cd0354e865c6e26e73ea562276ccd35f864ee6850777b67

See more details on using hashes here.

Provenance

The following attestation bundles were made for krigekit-0.2.4-py3-none-macosx_15_0_x86_64.whl:

Publisher: build_wheels.yml on ougx/krigekit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krigekit-0.2.4-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for krigekit-0.2.4-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c9ed14cfe21f7a677ae732da60ce615f821e80eabc2c434e55172fe0d96fdb73
MD5 a2d670cb5994a2d73c2624bc18f32061
BLAKE2b-256 d87c839c5395f61bfc2ecb321f6aefaf79579297096d2dbae8bb375feea0ea10

See more details on using hashes here.

Provenance

The following attestation bundles were made for krigekit-0.2.4-py3-none-macosx_14_0_arm64.whl:

Publisher: build_wheels.yml on ougx/krigekit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page