Soil texture triangle plotting and classification
Project description
Soil Texture Plot
This repository contains codebase for soil texture classification and visualization using ternary diagrams. It provides tools to plot soil texture data on texture triangles and classify soil samples according to different classification systems.
Features
- Ternary Plotting: Visualize soil texture data on interactive ternary diagrams
- Multiple Classification Systems: Support for USDA and HYPRES soil texture classification systems
- 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
Dependencies
- streamlit
- pandas
- numpy
- matplotlib
- mpltern
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.
Trusted publishing prerequisites
Before pushing release tags, configure trusted publishing:
- In GitHub, create environments named
pypiandtestpypiunder repository settings. - In PyPI project settings, add a trusted publisher matching this repository and the
publish-pypi.ymlworkflow. - In TestPyPI project settings, add a trusted publisher matching this repository and the
publish-testpypi.ymlworkflow.
Prerelease to TestPyPI
# Example: bump to prerelease version
uv version 0.1.2rc1
git add pyproject.toml uv.lock
git commit -m "Bump version to 0.1.2rc1"
git push origin dev
# After merge to main, create and push prerelease tag from main
git checkout main
git pull
git tag -a v0.1.2rc1 -m "Release v0.1.2rc1"
git push origin v0.1.2rc1
Smoke test from TestPyPI:
uv run --with "soiltextureplot==0.1.2rc1" --no-project -- python -c "import soiltextureplot"
Stable release to PyPI
# Example: bump stable version
uv version --bump patch
git add pyproject.toml uv.lock
git commit -m "Bump version"
git push origin dev
# After merge to main, create and push stable tag from main
git checkout main
git pull
git tag -a v0.1.2 -m "Release v0.1.2"
git push origin v0.1.2
Smoke test from PyPI:
uv run --with soiltextureplot --no-project -- python -c "import soiltextureplot"
Notebook Workflows (Pilot)
During the Marimo pilot, both notebook paths are supported:
- Jupyter notebook remains available at
texture_plot.ipynb - Marimo notebook copy is available at
notebooks/texture_plot_marimo.py - Keep existing
nbqachecks for.ipynbfiles during this phase
Run the Marimo notebook:
uv run marimo edit notebooks/texture_plot_marimo.py
Run the existing Jupyter notebook:
uv run jupyter notebook texture_plot.ipynb
Web Application
The 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
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.
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
Acknowledgments
- Built using mpltern for ternary plotting
- Inspired by soil science classification standards
- Streamlit for the web interface
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file soiltextureplot-0.1.3.tar.gz.
File metadata
- Download URL: soiltextureplot-0.1.3.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e87c6fbae6268bd1f0f6e58e5c28a6b294a71e7a57947e9daa8af670fa9096e9
|
|
| MD5 |
2353e60059d7c50164f5ac27b13898cc
|
|
| BLAKE2b-256 |
5b65c96e51f1b03cb93745d69d33a69709a8cf33b4847ce511f3d8ab98af6622
|
File details
Details for the file soiltextureplot-0.1.3-py3-none-any.whl.
File metadata
- Download URL: soiltextureplot-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
633755d6563b4be7de709a3d5b5ae5b2406edc675856aa1d03e4be622f322273
|
|
| MD5 |
bb01a893b649a267e7f9937a099cf2db
|
|
| BLAKE2b-256 |
762406558584b39bd042b593b7ebfd949ac07f1d8cc2a831c15121a901103348
|