Soil Digital Twin — Field Simulation & Bio-Inoculant Modeling
A spatial digital twin for agricultural fields: real DEM-derived terrain and hydrology, kriging-interpolated soil moisture, and a microbial-kinetics model tracking a bio-inoculant's fate after application — in a browser tool and a native desktop app.
This project models a field the way a hydrologist and a microbiologist would each want to see it, at the same time, on the same map. A digital elevation model drives real terrain analysis — slope, aspect, D8 flow direction, flow accumulation — which in turn drives a rainfall-event simulation that routes water across the terrain. Sparse sensor readings are spatially interpolated across the full field using kriging and IDW. And layered on top of the physical model is a microbial-kinetics simulation tracking the fate of an applied bio-inoculant: survival and activity as a function of soil temperature, moisture, and substrate availability, with a UV/desiccation decay process — extending the twin from a purely physical model into a biophysical one.
The project is honest about a distinction that matters: the hydrology and microbial-kinetics models are proof-of-concept-grade — functionally shaped correctly, with rate constants that are plausible order-of-magnitude placeholders rather than strain-calibrated measurements. The shape of the output is informative; the absolute numbers are illustrative until validated against real field sampling.
What it does
- Generates or ingests real terrain (DEM) and computes slope, aspect, and water flow paths
- Interpolates sparse sensor data across a field via kriging/IDW
- Simulates a rainfall event's effect on soil moisture distribution
- Models bio-inoculant survival and activity post-application, tied to the same spatial moisture/temperature fields
- Pulls real baseline soil chemistry (organic matter, pH, CEC, texture) from USDA-NRCS's SSURGO database for US locations
- Generates variable-rate fertigation prescriptions from the modeled state
- Renders a real 3D extruded terrain view with adjustable, always-labeled vertical exaggeration
Engineering notes
- Two parallel implementations: a dependency-free JavaScript version for the browser, and a Python package (NumPy/SciPy/pykrige) for the SSURGO lookups CORS blocks from a browser
- Packaged as a native desktop app via Tauri, with the Python pipeline callable from the UI through PyO3
- The 3D terrain mesh math was unit-tested independently before being embedded in the shipped tool