Soil Texture Plot
soiltextureplot is a Python package for soil texture classification and visualization with ternary diagrams.
Features
- Ternary Plotting: Visualize soil texture data on interactive ternary diagrams
- Multiple Classification Systems: Support for USDA and HYPRES soil texture classification systems
- Command-Line Interface: Classify CSVs and save texture triangle plots with
soiltextureplot - Interactive Web App: Streamlit-based application for easy data upload and visualization
- Flexible Data Input: Support for CSV files with customizable column mapping
- Point Classification: Automatic classification of soil samples into texture classes
- Customizable Visualization: Control point sizes, colors, and labels
Install
Install with uv:
uv add soiltextureplot
Install with pip:
pip install soiltextureplot
Optional app extras:
pip install "soiltextureplot[app]"
Quick Usage
import pandas as pd
from soiltextureplot.triangle import SoilTextureTriangle
example_df = pd.DataFrame(
{
"sample_id": ["S1", "S2", "S3", "S4"],
"sand": [75, 65, 45, 35],
"silt": [15, 20, 35, 40],
"clay": [10, 15, 20, 25],
"BD": [1.35, 1.42, 1.20, 1.18],
}
)
tri = SoilTextureTriangle(system_name="USDA")
tri.load_dataframe(example_df)
classified = tri.classify()
fig, ax = tri.plot(size_by="BD", cmap="viridis")
CLI
soiltextureplot list-systems
soiltextureplot classify data.csv -o classified.csv
soiltextureplot plot data.csv --size-by BD -o triangle.png
soiltextureplot run data.csv -o classified.csv -f triangle.png
Documentation
Full package docs are available on GitHub Pages:
Data Format
Your CSV file should contain soil texture data with percentages of sand, silt, and clay. The percentages should sum to 100% for each sample.
Example data format:
sample_id,sand,silt,clay
S1,65,20,15
S2,70,24,6
S3,75,21,4
Supported Classification Systems
USDA (United States Department of Agriculture)
The standard USDA soil texture classification system with 12 texture classes.
HYPRES (HYdraulic PRoperties of European Soils)
A European framework for classifying soils based on their hydrologic properties.
Web Application
The Streamlit web app allows you to:
- Upload CSV files with soil texture data
- Map columns to sand, silt, and clay percentages
- Visualize data on interactive texture triangles
- Customize plot appearance
Notebooks
Exploratory notebooks live at the repo root. Ruff formats and lints .ipynb files natively.
uv run jupyter notebook texture_plot.ipynb
Development
# Setup
uv sync --group dev
# Install git pre-commit hook
uv run pre-commit install
# Run all pre-commit checks on the repository
uv run pre-commit run --all-files
# Run one hook manually (example: ruff)
uv run pre-commit run ruff --all-files
# CI-style check-only quality commands (no auto-fixes)
uv run ruff format --check .
uv run ruff check .
uv run ty check src app
# Run tests
uv run pytest
# Build
uv build
# Publish (after updating version in pyproject.toml)
uv publish
Release Automation (GitHub Actions)
Publishing is automated via tag-triggered workflows:
v*rc*tags publish to TestPyPIv*.*.*tags are evaluated for PyPI; tags containingrcare skipped by workflow condition
Both workflows verify that the git tag version matches uv version --short before publishing.
Both workflows also run isolated wheel and source-distribution smoke tests (import soiltextureplot) before upload.
For maintainers, full trusted-publishing and release steps are documented in docs/releasing.md.
Acknowledgments
- Built using mpltern for ternary plotting
- Inspired by soil science classification standards
- Streamlit for the web interface
Metadata
Release files for soiltextureplot 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| soiltextureplot-0.1.5.tar.gz | 18.1 kB | Without provenance | Details for soiltextureplot-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| soiltextureplot-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for soiltextureplot-0.1.5-py3-none-any.whl |
Total release size: 35.2 kB
Release files / soiltextureplot-0.1.5.tar.gz
| Download URL | soiltextureplot-0.1.5.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1485a12e8d743afc91454f61f027c5a874ef1cd8825cf3a99eeb77ffcbcbeff0
|
|
BLAKE2b-256 checksum How to use checksums |
fbd0590e99322b590d16150d41e5fce488d05c847473624f10fead8e1545975b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / soiltextureplot-0.1.5-py3-none-any.whl
| Download URL | soiltextureplot-0.1.5-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c07ca2585104d678250f2a4465c33133502756a1fd021ab62b22a390cf69850b
|
|
BLAKE2b-256 checksum How to use checksums |
6819af779196e05222d74d4eb056ed28b423b09ff448fdf3c33018adce864a14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for soiltextureplot 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.