kriging-rs
Geostatistical kriging library with WASM support.
Installation
[]
= "0.1"
Or cargo add kriging-rs.
Usage
use ;
let coords = vec!;
let values = vec!;
let dataset = new?;
let variogram = new?;
let model = new?;
let prediction = model.predict?;
println!;
Features
- Ordinary, simple, universal, and binomial kriging for 2-D spatial interpolation
- Spatio-temporal kriging (ordinary / simple / universal / binomial) over a 2-D spatial axis and a scalar time axis, with separable and product-sum space-time variograms
- Empirical and parametric 2-D and space-time variogram fitting
- Leave-one-out and K-fold cross-validation for every 2-D and space-time variant (continuous residuals plus dual-scale logit+prevalence for binomial)
- Sequential Gaussian simulation (conditional simulation) for every 2-D and space-time variant, deterministic for a given RNG seed
- Variogram models: spherical, exponential, Gaussian, cubic, stable, Matérn, power, hole-effect (stable and Matérn accept an optional shape parameter)
- Geographic coordinates with Haversine distances and planar
(x, y)coordinates with 2-D anisotropy — both usable in the spatial and spatio-temporal paths - Optional WASM bindings for browser applications
Realabstraction defaults tof32for compute paths- Optional cross-platform GPU capability path via
wgpu
Build with --features wasm for browser; see below for GPU.
Repository layout
Root is the Rust crate. npm/kriging-rs-wasm/ is the TypeScript/WASM npm package. www/ is a browser demo (see www/README.md).
WASM and npm package
Build WASM:
The TypeScript/npm facade lives in npm/kriging-rs-wasm. See that package’s README for install, verify, and batch/typed-array APIs.
Browser demo: www/README.md.
Development
Install pre-commit and run pre-commit install so fmt and clippy run before each commit and match CI.
GPU
Features: gpu (async WebGPU via wgpu on native + web, including GPU-assisted RHS covariance for batch prediction) and gpu-blocking (native blocking helpers via pollster).
GPU batch prediction APIs are on OrdinaryKrigingModel / BinomialKrigingModel (Rust) and the WASM types (with wasm,gpu). See examples and the npm README for details.
Performance
Run cargo bench for current numbers; see bench-results/README.md for logging and comparison.
License
Licensed under MIT.