soiltextureplot 0.1.0__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- soiltextureplot-0.1.3/PKG-INFO +195 -0
- soiltextureplot-0.1.3/README.md +170 -0
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3}/pyproject.toml +26 -10
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot/classifier.py +2 -4
- soiltextureplot-0.1.3/src/soiltextureplot/data/example_soil_data.csv +6 -0
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot/datasets.py +1 -1
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot/plotting.py +36 -15
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot/systems.py +3 -1
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot/triangle.py +7 -7
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot/utils.py +1 -4
- soiltextureplot-0.1.3/src/soiltextureplot.egg-info/PKG-INFO +195 -0
- soiltextureplot-0.1.3/src/soiltextureplot.egg-info/SOURCES.txt +17 -0
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot.egg-info/requires.txt +3 -0
- soiltextureplot-0.1.3/tests/test_smoke.py +60 -0
- soiltextureplot-0.1.0/PKG-INFO +0 -106
- soiltextureplot-0.1.0/README.md +0 -58
- soiltextureplot-0.1.0/soiltextureplot.egg-info/PKG-INFO +0 -106
- soiltextureplot-0.1.0/soiltextureplot.egg-info/SOURCES.txt +0 -15
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3}/LICENSE +0 -0
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3}/setup.cfg +0 -0
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot/__init__.py +1 -1
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot.egg-info/dependency_links.txt +0 -0
- {soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: soiltextureplot
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Soil texture triangle plotting and classification
|
|
5
|
+
Author-email: Amninder Singh <amnindersingh13@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/singhamninder/soiltextureplot
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/singhamninder/soiltextureplot/issues
|
|
9
|
+
Keywords: soil,texture,triangle,plot,classification,ternary
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering
|
|
15
|
+
Requires-Python: >=3.12
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: pandas>=1.5.0
|
|
19
|
+
Requires-Dist: numpy>=1.23.0
|
|
20
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
21
|
+
Requires-Dist: mpltern>=1.0.0
|
|
22
|
+
Provides-Extra: app
|
|
23
|
+
Requires-Dist: streamlit>=1.57.0; extra == "app"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# Soil Texture Plot
|
|
27
|
+
|
|
28
|
+
[](https://soiltextureplot.streamlit.app/)
|
|
29
|
+
|
|
30
|
+
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.
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- **Ternary Plotting**: Visualize soil texture data on interactive ternary diagrams
|
|
35
|
+
- **Multiple Classification Systems**: Support for USDA and HYPRES soil texture classification systems
|
|
36
|
+
- **Interactive Web App**: Streamlit-based application for easy data upload and visualization
|
|
37
|
+
- **Flexible Data Input**: Support for CSV files with customizable column mapping
|
|
38
|
+
- **Point Classification**: Automatic classification of soil samples into texture classes
|
|
39
|
+
- **Customizable Visualization**: Control point sizes, colors, and labels
|
|
40
|
+
|
|
41
|
+
## Dependencies
|
|
42
|
+
|
|
43
|
+
- streamlit
|
|
44
|
+
- pandas
|
|
45
|
+
- numpy
|
|
46
|
+
- matplotlib
|
|
47
|
+
- mpltern
|
|
48
|
+
|
|
49
|
+
## Development
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Setup
|
|
53
|
+
uv sync --group dev
|
|
54
|
+
|
|
55
|
+
# Install git pre-commit hook
|
|
56
|
+
uv run pre-commit install
|
|
57
|
+
|
|
58
|
+
# Run all pre-commit checks on the repository
|
|
59
|
+
uv run pre-commit run --all-files
|
|
60
|
+
|
|
61
|
+
# Run one hook manually (example: ruff)
|
|
62
|
+
uv run pre-commit run ruff --all-files
|
|
63
|
+
|
|
64
|
+
# CI-style check-only quality commands (no auto-fixes)
|
|
65
|
+
uv run ruff format --check .
|
|
66
|
+
uv run ruff check .
|
|
67
|
+
uv run ty check src app
|
|
68
|
+
|
|
69
|
+
# Run tests
|
|
70
|
+
uv run pytest
|
|
71
|
+
|
|
72
|
+
# Build
|
|
73
|
+
uv build
|
|
74
|
+
|
|
75
|
+
# Publish (after updating version in pyproject.toml)
|
|
76
|
+
uv publish
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Release Automation (GitHub Actions)
|
|
80
|
+
|
|
81
|
+
Publishing is automated via tag-triggered workflows:
|
|
82
|
+
|
|
83
|
+
- `v*rc*` tags publish to TestPyPI
|
|
84
|
+
- `v*.*.*` tags are evaluated for PyPI; tags containing `rc` are skipped by workflow condition
|
|
85
|
+
|
|
86
|
+
Both workflows verify that the git tag version matches `uv version --short` before publishing.
|
|
87
|
+
Both workflows also run isolated wheel and source-distribution smoke tests (`import soiltextureplot`) before upload.
|
|
88
|
+
|
|
89
|
+
### Trusted publishing prerequisites
|
|
90
|
+
|
|
91
|
+
Before pushing release tags, configure trusted publishing:
|
|
92
|
+
|
|
93
|
+
1. In GitHub, create environments named `pypi` and `testpypi` under repository settings.
|
|
94
|
+
2. In PyPI project settings, add a trusted publisher matching this repository and the `publish-pypi.yml` workflow.
|
|
95
|
+
3. In TestPyPI project settings, add a trusted publisher matching this repository and the `publish-testpypi.yml` workflow.
|
|
96
|
+
|
|
97
|
+
### Prerelease to TestPyPI
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Example: bump to prerelease version
|
|
101
|
+
uv version 0.1.2rc1
|
|
102
|
+
git add pyproject.toml uv.lock
|
|
103
|
+
git commit -m "Bump version to 0.1.2rc1"
|
|
104
|
+
git push origin dev
|
|
105
|
+
|
|
106
|
+
# After merge to main, create and push prerelease tag from main
|
|
107
|
+
git checkout main
|
|
108
|
+
git pull
|
|
109
|
+
git tag -a v0.1.2rc1 -m "Release v0.1.2rc1"
|
|
110
|
+
git push origin v0.1.2rc1
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Smoke test from TestPyPI:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
uv run --with "soiltextureplot==0.1.2rc1" --no-project -- python -c "import soiltextureplot"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Stable release to PyPI
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Example: bump stable version
|
|
123
|
+
uv version --bump patch
|
|
124
|
+
git add pyproject.toml uv.lock
|
|
125
|
+
git commit -m "Bump version"
|
|
126
|
+
git push origin dev
|
|
127
|
+
|
|
128
|
+
# After merge to main, create and push stable tag from main
|
|
129
|
+
git checkout main
|
|
130
|
+
git pull
|
|
131
|
+
git tag -a v0.1.2 -m "Release v0.1.2"
|
|
132
|
+
git push origin v0.1.2
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Smoke test from PyPI:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
uv run --with soiltextureplot --no-project -- python -c "import soiltextureplot"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Notebook Workflows (Pilot)
|
|
142
|
+
|
|
143
|
+
During the Marimo pilot, both notebook paths are supported:
|
|
144
|
+
|
|
145
|
+
- Jupyter notebook remains available at `texture_plot.ipynb`
|
|
146
|
+
- Marimo notebook copy is available at `notebooks/texture_plot_marimo.py`
|
|
147
|
+
- Keep existing `nbqa` checks for `.ipynb` files during this phase
|
|
148
|
+
|
|
149
|
+
Run the Marimo notebook:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
uv run marimo edit notebooks/texture_plot_marimo.py
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Run the existing Jupyter notebook:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
uv run jupyter notebook texture_plot.ipynb
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## Web Application
|
|
163
|
+
|
|
164
|
+
The web app allows you to:
|
|
165
|
+
- Upload CSV files with soil texture data
|
|
166
|
+
- Map columns to sand, silt, and clay percentages
|
|
167
|
+
- Visualize data on interactive texture triangles
|
|
168
|
+
- Customize plot appearance
|
|
169
|
+
|
|
170
|
+
## Supported Classification Systems
|
|
171
|
+
|
|
172
|
+
### USDA (United States Department of Agriculture)
|
|
173
|
+
The standard USDA soil texture classification system with 12 texture classes.
|
|
174
|
+
|
|
175
|
+
### HYPRES (HYdraulic PRoperties of European Soils)
|
|
176
|
+
A European framework for classifying soils based on their hydrologic properties.
|
|
177
|
+
|
|
178
|
+
## Data Format
|
|
179
|
+
|
|
180
|
+
Your CSV file should contain soil texture data with percentages of sand, silt, and clay. The percentages should sum to 100% for each sample.
|
|
181
|
+
|
|
182
|
+
Example data format:
|
|
183
|
+
|
|
184
|
+
```csv
|
|
185
|
+
sample_id,sand,silt,clay
|
|
186
|
+
S1,65,20,15
|
|
187
|
+
S2,70,24,6
|
|
188
|
+
S3,75,21,4
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Acknowledgments
|
|
192
|
+
|
|
193
|
+
- Built using [mpltern](https://github.com/yuzie007/mpltern) for ternary plotting
|
|
194
|
+
- Inspired by soil science classification standards
|
|
195
|
+
- Streamlit for the web interface
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Soil Texture Plot
|
|
2
|
+
|
|
3
|
+
[](https://soiltextureplot.streamlit.app/)
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Ternary Plotting**: Visualize soil texture data on interactive ternary diagrams
|
|
10
|
+
- **Multiple Classification Systems**: Support for USDA and HYPRES soil texture classification systems
|
|
11
|
+
- **Interactive Web App**: Streamlit-based application for easy data upload and visualization
|
|
12
|
+
- **Flexible Data Input**: Support for CSV files with customizable column mapping
|
|
13
|
+
- **Point Classification**: Automatic classification of soil samples into texture classes
|
|
14
|
+
- **Customizable Visualization**: Control point sizes, colors, and labels
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
- streamlit
|
|
19
|
+
- pandas
|
|
20
|
+
- numpy
|
|
21
|
+
- matplotlib
|
|
22
|
+
- mpltern
|
|
23
|
+
|
|
24
|
+
## Development
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Setup
|
|
28
|
+
uv sync --group dev
|
|
29
|
+
|
|
30
|
+
# Install git pre-commit hook
|
|
31
|
+
uv run pre-commit install
|
|
32
|
+
|
|
33
|
+
# Run all pre-commit checks on the repository
|
|
34
|
+
uv run pre-commit run --all-files
|
|
35
|
+
|
|
36
|
+
# Run one hook manually (example: ruff)
|
|
37
|
+
uv run pre-commit run ruff --all-files
|
|
38
|
+
|
|
39
|
+
# CI-style check-only quality commands (no auto-fixes)
|
|
40
|
+
uv run ruff format --check .
|
|
41
|
+
uv run ruff check .
|
|
42
|
+
uv run ty check src app
|
|
43
|
+
|
|
44
|
+
# Run tests
|
|
45
|
+
uv run pytest
|
|
46
|
+
|
|
47
|
+
# Build
|
|
48
|
+
uv build
|
|
49
|
+
|
|
50
|
+
# Publish (after updating version in pyproject.toml)
|
|
51
|
+
uv publish
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Release Automation (GitHub Actions)
|
|
55
|
+
|
|
56
|
+
Publishing is automated via tag-triggered workflows:
|
|
57
|
+
|
|
58
|
+
- `v*rc*` tags publish to TestPyPI
|
|
59
|
+
- `v*.*.*` tags are evaluated for PyPI; tags containing `rc` are skipped by workflow condition
|
|
60
|
+
|
|
61
|
+
Both workflows verify that the git tag version matches `uv version --short` before publishing.
|
|
62
|
+
Both workflows also run isolated wheel and source-distribution smoke tests (`import soiltextureplot`) before upload.
|
|
63
|
+
|
|
64
|
+
### Trusted publishing prerequisites
|
|
65
|
+
|
|
66
|
+
Before pushing release tags, configure trusted publishing:
|
|
67
|
+
|
|
68
|
+
1. In GitHub, create environments named `pypi` and `testpypi` under repository settings.
|
|
69
|
+
2. In PyPI project settings, add a trusted publisher matching this repository and the `publish-pypi.yml` workflow.
|
|
70
|
+
3. In TestPyPI project settings, add a trusted publisher matching this repository and the `publish-testpypi.yml` workflow.
|
|
71
|
+
|
|
72
|
+
### Prerelease to TestPyPI
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Example: bump to prerelease version
|
|
76
|
+
uv version 0.1.2rc1
|
|
77
|
+
git add pyproject.toml uv.lock
|
|
78
|
+
git commit -m "Bump version to 0.1.2rc1"
|
|
79
|
+
git push origin dev
|
|
80
|
+
|
|
81
|
+
# After merge to main, create and push prerelease tag from main
|
|
82
|
+
git checkout main
|
|
83
|
+
git pull
|
|
84
|
+
git tag -a v0.1.2rc1 -m "Release v0.1.2rc1"
|
|
85
|
+
git push origin v0.1.2rc1
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Smoke test from TestPyPI:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv run --with "soiltextureplot==0.1.2rc1" --no-project -- python -c "import soiltextureplot"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Stable release to PyPI
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Example: bump stable version
|
|
98
|
+
uv version --bump patch
|
|
99
|
+
git add pyproject.toml uv.lock
|
|
100
|
+
git commit -m "Bump version"
|
|
101
|
+
git push origin dev
|
|
102
|
+
|
|
103
|
+
# After merge to main, create and push stable tag from main
|
|
104
|
+
git checkout main
|
|
105
|
+
git pull
|
|
106
|
+
git tag -a v0.1.2 -m "Release v0.1.2"
|
|
107
|
+
git push origin v0.1.2
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Smoke test from PyPI:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uv run --with soiltextureplot --no-project -- python -c "import soiltextureplot"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Notebook Workflows (Pilot)
|
|
117
|
+
|
|
118
|
+
During the Marimo pilot, both notebook paths are supported:
|
|
119
|
+
|
|
120
|
+
- Jupyter notebook remains available at `texture_plot.ipynb`
|
|
121
|
+
- Marimo notebook copy is available at `notebooks/texture_plot_marimo.py`
|
|
122
|
+
- Keep existing `nbqa` checks for `.ipynb` files during this phase
|
|
123
|
+
|
|
124
|
+
Run the Marimo notebook:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
uv run marimo edit notebooks/texture_plot_marimo.py
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Run the existing Jupyter notebook:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
uv run jupyter notebook texture_plot.ipynb
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
## Web Application
|
|
138
|
+
|
|
139
|
+
The web app allows you to:
|
|
140
|
+
- Upload CSV files with soil texture data
|
|
141
|
+
- Map columns to sand, silt, and clay percentages
|
|
142
|
+
- Visualize data on interactive texture triangles
|
|
143
|
+
- Customize plot appearance
|
|
144
|
+
|
|
145
|
+
## Supported Classification Systems
|
|
146
|
+
|
|
147
|
+
### USDA (United States Department of Agriculture)
|
|
148
|
+
The standard USDA soil texture classification system with 12 texture classes.
|
|
149
|
+
|
|
150
|
+
### HYPRES (HYdraulic PRoperties of European Soils)
|
|
151
|
+
A European framework for classifying soils based on their hydrologic properties.
|
|
152
|
+
|
|
153
|
+
## Data Format
|
|
154
|
+
|
|
155
|
+
Your CSV file should contain soil texture data with percentages of sand, silt, and clay. The percentages should sum to 100% for each sample.
|
|
156
|
+
|
|
157
|
+
Example data format:
|
|
158
|
+
|
|
159
|
+
```csv
|
|
160
|
+
sample_id,sand,silt,clay
|
|
161
|
+
S1,65,20,15
|
|
162
|
+
S2,70,24,6
|
|
163
|
+
S3,75,21,4
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Acknowledgments
|
|
167
|
+
|
|
168
|
+
- Built using [mpltern](https://github.com/yuzie007/mpltern) for ternary plotting
|
|
169
|
+
- Inspired by soil science classification standards
|
|
170
|
+
- Streamlit for the web interface
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "soiltextureplot"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "Soil texture triangle plotting and classification"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
license =
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
11
12
|
authors = [
|
|
12
13
|
{ name = "Amninder Singh", email = "amnindersingh13@gmail.com"},
|
|
13
14
|
]
|
|
14
|
-
requires-python = ">=3.
|
|
15
|
+
requires-python = ">=3.12"
|
|
15
16
|
dependencies = [
|
|
16
17
|
"pandas>=1.5.0",
|
|
17
18
|
"numpy>=1.23.0",
|
|
@@ -22,11 +23,7 @@ keywords = ["soil", "texture", "triangle", "plot", "classification", "ternary"]
|
|
|
22
23
|
classifiers = [
|
|
23
24
|
"Development Status :: 4 - Beta",
|
|
24
25
|
"Intended Audience :: Science/Research",
|
|
25
|
-
"License :: OSI Approved :: MIT License",
|
|
26
26
|
"Programming Language :: Python :: 3",
|
|
27
|
-
"Programming Language :: Python :: 3.9",
|
|
28
|
-
"Programming Language :: Python :: 3.10",
|
|
29
|
-
"Programming Language :: Python :: 3.11",
|
|
30
27
|
"Programming Language :: Python :: 3.12",
|
|
31
28
|
"Topic :: Scientific/Engineering",
|
|
32
29
|
]
|
|
@@ -35,5 +32,24 @@ classifiers = [
|
|
|
35
32
|
"Homepage" = "https://github.com/singhamninder/soiltextureplot"
|
|
36
33
|
"Bug Tracker" = "https://github.com/singhamninder/soiltextureplot/issues"
|
|
37
34
|
|
|
38
|
-
[
|
|
39
|
-
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
app = [
|
|
37
|
+
"streamlit>=1.57.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.package-data]
|
|
44
|
+
soiltextureplot = ["data/*.csv"]
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = [
|
|
48
|
+
"pytest>=7.4",
|
|
49
|
+
"pytest-cov>=4.1",
|
|
50
|
+
"ruff>=0.4",
|
|
51
|
+
"nbqa>=1.9.1",
|
|
52
|
+
"marimo>=0.17.6",
|
|
53
|
+
"ty>=0.0.34",
|
|
54
|
+
"pre-commit>=4.3.0",
|
|
55
|
+
]
|
|
@@ -22,6 +22,7 @@ class PolygonClassifier:
|
|
|
22
22
|
_class_order : List[str]
|
|
23
23
|
Ordered list of class names for consistency.
|
|
24
24
|
"""
|
|
25
|
+
|
|
25
26
|
system: TextureSystem
|
|
26
27
|
_paths: Dict[str, Path]
|
|
27
28
|
_class_order: List[str]
|
|
@@ -57,10 +58,7 @@ class PolygonClassifier:
|
|
|
57
58
|
return cls(system=system, _paths=paths, _class_order=class_order)
|
|
58
59
|
|
|
59
60
|
def classify_points(
|
|
60
|
-
self,
|
|
61
|
-
clay: np.ndarray,
|
|
62
|
-
sand: np.ndarray,
|
|
63
|
-
silt: np.ndarray
|
|
61
|
+
self, clay: np.ndarray, sand: np.ndarray, silt: np.ndarray
|
|
64
62
|
) -> np.ndarray:
|
|
65
63
|
"""
|
|
66
64
|
Classify many points at once.
|
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
from typing import Any, List, Optional, Protocol, Tuple, Union, cast
|
|
2
|
+
|
|
2
3
|
import matplotlib.pyplot as plt
|
|
4
|
+
import mpltern # noqa: F401 # Registers the "ternary" Matplotlib projection.
|
|
5
|
+
import numpy as np
|
|
3
6
|
import pandas as pd
|
|
4
|
-
|
|
5
|
-
from typing import Optional, Union, List, Tuple
|
|
6
|
-
from matplotlib.figure import Figure
|
|
7
|
+
from matplotlib import colormaps
|
|
7
8
|
from matplotlib.axes import Axes
|
|
8
9
|
from matplotlib.colors import Colormap
|
|
10
|
+
from matplotlib.figure import Figure
|
|
9
11
|
from matplotlib.ticker import AutoMinorLocator, MultipleLocator
|
|
10
|
-
from matplotlib import colormaps
|
|
11
12
|
|
|
12
13
|
from .systems import TextureSystem
|
|
13
14
|
from .utils import calculate_centroid
|
|
14
15
|
|
|
15
16
|
|
|
17
|
+
class TernaryAxisLike(Protocol):
|
|
18
|
+
"""Typed subset of mpltern axis API used in this module."""
|
|
19
|
+
|
|
20
|
+
taxis: Any
|
|
21
|
+
laxis: Any
|
|
22
|
+
raxis: Any
|
|
23
|
+
transData: Any
|
|
24
|
+
transTernaryAxes: Any
|
|
25
|
+
|
|
26
|
+
def scatter(self, *args: Any, **kwargs: Any) -> Any: ...
|
|
27
|
+
|
|
28
|
+
def fill(self, *args: Any, **kwargs: Any) -> list[Any]: ...
|
|
29
|
+
|
|
30
|
+
def text(self, *args: Any, **kwargs: Any) -> Any: ...
|
|
31
|
+
|
|
32
|
+
def set_title(self, *args: Any, **kwargs: Any) -> Any: ...
|
|
33
|
+
|
|
34
|
+
def grid(self, *args: Any, **kwargs: Any) -> Any: ...
|
|
35
|
+
|
|
36
|
+
|
|
16
37
|
def plot_triangle_with_points(
|
|
17
38
|
df: pd.DataFrame,
|
|
18
39
|
system: TextureSystem,
|
|
@@ -53,23 +74,22 @@ def plot_triangle_with_points(
|
|
|
53
74
|
ax : Axes
|
|
54
75
|
The matplotlib Axes object (ternary projection).
|
|
55
76
|
"""
|
|
56
|
-
import mpltern # imported here so core doesn’t hard‑depend for non‑plot use
|
|
57
77
|
|
|
58
78
|
fig = plt.figure(figsize=(7, 6))
|
|
59
|
-
ax = fig.add_subplot(projection="ternary", ternary_sum=100.0)
|
|
79
|
+
ax = cast(TernaryAxisLike, fig.add_subplot(projection="ternary", ternary_sum=100.0))
|
|
60
80
|
|
|
61
81
|
_plot_background_classes(ax, system, cmap=cmap)
|
|
62
82
|
|
|
63
83
|
# coordinates in ternary order (clay, sand, silt)
|
|
64
84
|
t = df["clay"].to_numpy()
|
|
65
|
-
|
|
85
|
+
left = df["sand"].to_numpy()
|
|
66
86
|
r = df["silt"].to_numpy()
|
|
67
87
|
|
|
68
88
|
sizes = _compute_sizes(df, size_by, size_min, size_max)
|
|
69
89
|
|
|
70
90
|
ax.scatter(
|
|
71
91
|
t,
|
|
72
|
-
|
|
92
|
+
left,
|
|
73
93
|
r,
|
|
74
94
|
c=color_points,
|
|
75
95
|
alpha=0.7,
|
|
@@ -78,7 +98,7 @@ def plot_triangle_with_points(
|
|
|
78
98
|
)
|
|
79
99
|
|
|
80
100
|
if show_labels and "sample_id" in df.columns:
|
|
81
|
-
for (_, row), tt, ll, rr in zip(df.iterrows(), t,
|
|
101
|
+
for (_, row), tt, ll, rr in zip(df.iterrows(), t, left, r):
|
|
82
102
|
ax.text(
|
|
83
103
|
tt,
|
|
84
104
|
ll,
|
|
@@ -92,13 +112,13 @@ def plot_triangle_with_points(
|
|
|
92
112
|
|
|
93
113
|
ax.set_title(f"{system.name} Soil Texture Triangle", weight="bold", pad=20)
|
|
94
114
|
fig.tight_layout()
|
|
95
|
-
return fig, ax
|
|
115
|
+
return fig, cast(Axes, ax)
|
|
96
116
|
|
|
97
117
|
|
|
98
118
|
def _plot_background_classes(
|
|
99
|
-
ax:
|
|
119
|
+
ax: TernaryAxisLike,
|
|
100
120
|
system: TextureSystem,
|
|
101
|
-
cmap: Optional[Union[str, List[str], Colormap]] = None
|
|
121
|
+
cmap: Optional[Union[str, List[str], Colormap]] = None,
|
|
102
122
|
) -> None:
|
|
103
123
|
"""
|
|
104
124
|
Plots the texture class polygons in the background.
|
|
@@ -139,10 +159,11 @@ def _plot_background_classes(
|
|
|
139
159
|
|
|
140
160
|
# Cycle through colors if not enough are provided for the polygons.
|
|
141
161
|
# This is a safeguard, though resampled() should give the correct number.
|
|
162
|
+
assert colors is not None
|
|
142
163
|
if len(colors) < num_polygons:
|
|
143
164
|
color_cycle = cycle(colors)
|
|
144
165
|
else:
|
|
145
|
-
color_cycle = colors
|
|
166
|
+
color_cycle = colors
|
|
146
167
|
|
|
147
168
|
for (name, vertices), color in zip(system.polygons.items(), color_cycle):
|
|
148
169
|
tn0, tn1, tn2 = np.array(vertices).T # clay, sand, silt
|
|
@@ -225,7 +246,7 @@ def _compute_sizes(
|
|
|
225
246
|
df: pd.DataFrame,
|
|
226
247
|
size_by: Optional[str],
|
|
227
248
|
size_min: Optional[float],
|
|
228
|
-
size_max: Optional[float]
|
|
249
|
+
size_max: Optional[float],
|
|
229
250
|
) -> Union[float, np.ndarray]:
|
|
230
251
|
"""Helper to compute point sizes based on a column."""
|
|
231
252
|
if size_min is None:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Any, Dict, Mapping
|
|
3
|
+
|
|
3
4
|
from . import datasets
|
|
4
5
|
|
|
5
6
|
|
|
@@ -17,6 +18,7 @@ class TextureSystem:
|
|
|
17
18
|
meta : Mapping[str, Any]
|
|
18
19
|
Metadata about the system (description, citation, etc.).
|
|
19
20
|
"""
|
|
21
|
+
|
|
20
22
|
name: str
|
|
21
23
|
polygons: Mapping[str, Any]
|
|
22
24
|
meta: Mapping[str, Any]
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
import pandas as pd
|
|
3
|
-
|
|
4
1
|
from dataclasses import dataclass, field
|
|
5
2
|
from pathlib import Path as PathLibPath
|
|
6
|
-
from typing import Optional, Union
|
|
7
|
-
|
|
3
|
+
from typing import TYPE_CHECKING, Optional, Union
|
|
4
|
+
|
|
5
|
+
import pandas as pd
|
|
8
6
|
from matplotlib.axes import Axes
|
|
7
|
+
from matplotlib.figure import Figure
|
|
9
8
|
|
|
10
|
-
from .systems import get_texture_system, TextureSystem
|
|
11
|
-
from .classifier import PolygonClassifier
|
|
12
9
|
from . import plotting
|
|
10
|
+
from .classifier import PolygonClassifier
|
|
11
|
+
from .systems import TextureSystem, get_texture_system
|
|
13
12
|
|
|
14
13
|
if TYPE_CHECKING:
|
|
15
14
|
# Avoid circular import at runtime by only importing for type checking if needed
|
|
@@ -28,6 +27,7 @@ class SoilTextureTriangle:
|
|
|
28
27
|
df : pd.DataFrame, optional
|
|
29
28
|
Initial DataFrame. Can be set later via load functions.
|
|
30
29
|
"""
|
|
30
|
+
|
|
31
31
|
system_name: str = "USDA"
|
|
32
32
|
df: Optional[pd.DataFrame] = field(default=None, repr=False)
|
|
33
33
|
|
|
@@ -37,10 +37,7 @@ def calculate_centroid(vertices: np.ndarray) -> np.ndarray:
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
def ternary_to_cartesian(
|
|
40
|
-
clay: np.ndarray,
|
|
41
|
-
sand: np.ndarray,
|
|
42
|
-
silt: np.ndarray,
|
|
43
|
-
ternary_sum: float = 100.0
|
|
40
|
+
clay: np.ndarray, sand: np.ndarray, silt: np.ndarray, ternary_sum: float = 100.0
|
|
44
41
|
) -> np.ndarray:
|
|
45
42
|
"""
|
|
46
43
|
Convert ternary coordinates (clay, sand, silt) to 2D Cartesian (x, y).
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: soiltextureplot
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Soil texture triangle plotting and classification
|
|
5
|
+
Author-email: Amninder Singh <amnindersingh13@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/singhamninder/soiltextureplot
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/singhamninder/soiltextureplot/issues
|
|
9
|
+
Keywords: soil,texture,triangle,plot,classification,ternary
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering
|
|
15
|
+
Requires-Python: >=3.12
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: pandas>=1.5.0
|
|
19
|
+
Requires-Dist: numpy>=1.23.0
|
|
20
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
21
|
+
Requires-Dist: mpltern>=1.0.0
|
|
22
|
+
Provides-Extra: app
|
|
23
|
+
Requires-Dist: streamlit>=1.57.0; extra == "app"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# Soil Texture Plot
|
|
27
|
+
|
|
28
|
+
[](https://soiltextureplot.streamlit.app/)
|
|
29
|
+
|
|
30
|
+
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.
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- **Ternary Plotting**: Visualize soil texture data on interactive ternary diagrams
|
|
35
|
+
- **Multiple Classification Systems**: Support for USDA and HYPRES soil texture classification systems
|
|
36
|
+
- **Interactive Web App**: Streamlit-based application for easy data upload and visualization
|
|
37
|
+
- **Flexible Data Input**: Support for CSV files with customizable column mapping
|
|
38
|
+
- **Point Classification**: Automatic classification of soil samples into texture classes
|
|
39
|
+
- **Customizable Visualization**: Control point sizes, colors, and labels
|
|
40
|
+
|
|
41
|
+
## Dependencies
|
|
42
|
+
|
|
43
|
+
- streamlit
|
|
44
|
+
- pandas
|
|
45
|
+
- numpy
|
|
46
|
+
- matplotlib
|
|
47
|
+
- mpltern
|
|
48
|
+
|
|
49
|
+
## Development
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Setup
|
|
53
|
+
uv sync --group dev
|
|
54
|
+
|
|
55
|
+
# Install git pre-commit hook
|
|
56
|
+
uv run pre-commit install
|
|
57
|
+
|
|
58
|
+
# Run all pre-commit checks on the repository
|
|
59
|
+
uv run pre-commit run --all-files
|
|
60
|
+
|
|
61
|
+
# Run one hook manually (example: ruff)
|
|
62
|
+
uv run pre-commit run ruff --all-files
|
|
63
|
+
|
|
64
|
+
# CI-style check-only quality commands (no auto-fixes)
|
|
65
|
+
uv run ruff format --check .
|
|
66
|
+
uv run ruff check .
|
|
67
|
+
uv run ty check src app
|
|
68
|
+
|
|
69
|
+
# Run tests
|
|
70
|
+
uv run pytest
|
|
71
|
+
|
|
72
|
+
# Build
|
|
73
|
+
uv build
|
|
74
|
+
|
|
75
|
+
# Publish (after updating version in pyproject.toml)
|
|
76
|
+
uv publish
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Release Automation (GitHub Actions)
|
|
80
|
+
|
|
81
|
+
Publishing is automated via tag-triggered workflows:
|
|
82
|
+
|
|
83
|
+
- `v*rc*` tags publish to TestPyPI
|
|
84
|
+
- `v*.*.*` tags are evaluated for PyPI; tags containing `rc` are skipped by workflow condition
|
|
85
|
+
|
|
86
|
+
Both workflows verify that the git tag version matches `uv version --short` before publishing.
|
|
87
|
+
Both workflows also run isolated wheel and source-distribution smoke tests (`import soiltextureplot`) before upload.
|
|
88
|
+
|
|
89
|
+
### Trusted publishing prerequisites
|
|
90
|
+
|
|
91
|
+
Before pushing release tags, configure trusted publishing:
|
|
92
|
+
|
|
93
|
+
1. In GitHub, create environments named `pypi` and `testpypi` under repository settings.
|
|
94
|
+
2. In PyPI project settings, add a trusted publisher matching this repository and the `publish-pypi.yml` workflow.
|
|
95
|
+
3. In TestPyPI project settings, add a trusted publisher matching this repository and the `publish-testpypi.yml` workflow.
|
|
96
|
+
|
|
97
|
+
### Prerelease to TestPyPI
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Example: bump to prerelease version
|
|
101
|
+
uv version 0.1.2rc1
|
|
102
|
+
git add pyproject.toml uv.lock
|
|
103
|
+
git commit -m "Bump version to 0.1.2rc1"
|
|
104
|
+
git push origin dev
|
|
105
|
+
|
|
106
|
+
# After merge to main, create and push prerelease tag from main
|
|
107
|
+
git checkout main
|
|
108
|
+
git pull
|
|
109
|
+
git tag -a v0.1.2rc1 -m "Release v0.1.2rc1"
|
|
110
|
+
git push origin v0.1.2rc1
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Smoke test from TestPyPI:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
uv run --with "soiltextureplot==0.1.2rc1" --no-project -- python -c "import soiltextureplot"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Stable release to PyPI
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Example: bump stable version
|
|
123
|
+
uv version --bump patch
|
|
124
|
+
git add pyproject.toml uv.lock
|
|
125
|
+
git commit -m "Bump version"
|
|
126
|
+
git push origin dev
|
|
127
|
+
|
|
128
|
+
# After merge to main, create and push stable tag from main
|
|
129
|
+
git checkout main
|
|
130
|
+
git pull
|
|
131
|
+
git tag -a v0.1.2 -m "Release v0.1.2"
|
|
132
|
+
git push origin v0.1.2
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Smoke test from PyPI:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
uv run --with soiltextureplot --no-project -- python -c "import soiltextureplot"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Notebook Workflows (Pilot)
|
|
142
|
+
|
|
143
|
+
During the Marimo pilot, both notebook paths are supported:
|
|
144
|
+
|
|
145
|
+
- Jupyter notebook remains available at `texture_plot.ipynb`
|
|
146
|
+
- Marimo notebook copy is available at `notebooks/texture_plot_marimo.py`
|
|
147
|
+
- Keep existing `nbqa` checks for `.ipynb` files during this phase
|
|
148
|
+
|
|
149
|
+
Run the Marimo notebook:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
uv run marimo edit notebooks/texture_plot_marimo.py
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Run the existing Jupyter notebook:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
uv run jupyter notebook texture_plot.ipynb
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## Web Application
|
|
163
|
+
|
|
164
|
+
The web app allows you to:
|
|
165
|
+
- Upload CSV files with soil texture data
|
|
166
|
+
- Map columns to sand, silt, and clay percentages
|
|
167
|
+
- Visualize data on interactive texture triangles
|
|
168
|
+
- Customize plot appearance
|
|
169
|
+
|
|
170
|
+
## Supported Classification Systems
|
|
171
|
+
|
|
172
|
+
### USDA (United States Department of Agriculture)
|
|
173
|
+
The standard USDA soil texture classification system with 12 texture classes.
|
|
174
|
+
|
|
175
|
+
### HYPRES (HYdraulic PRoperties of European Soils)
|
|
176
|
+
A European framework for classifying soils based on their hydrologic properties.
|
|
177
|
+
|
|
178
|
+
## Data Format
|
|
179
|
+
|
|
180
|
+
Your CSV file should contain soil texture data with percentages of sand, silt, and clay. The percentages should sum to 100% for each sample.
|
|
181
|
+
|
|
182
|
+
Example data format:
|
|
183
|
+
|
|
184
|
+
```csv
|
|
185
|
+
sample_id,sand,silt,clay
|
|
186
|
+
S1,65,20,15
|
|
187
|
+
S2,70,24,6
|
|
188
|
+
S3,75,21,4
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Acknowledgments
|
|
192
|
+
|
|
193
|
+
- Built using [mpltern](https://github.com/yuzie007/mpltern) for ternary plotting
|
|
194
|
+
- Inspired by soil science classification standards
|
|
195
|
+
- Streamlit for the web interface
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/soiltextureplot/__init__.py
|
|
5
|
+
src/soiltextureplot/classifier.py
|
|
6
|
+
src/soiltextureplot/datasets.py
|
|
7
|
+
src/soiltextureplot/plotting.py
|
|
8
|
+
src/soiltextureplot/systems.py
|
|
9
|
+
src/soiltextureplot/triangle.py
|
|
10
|
+
src/soiltextureplot/utils.py
|
|
11
|
+
src/soiltextureplot.egg-info/PKG-INFO
|
|
12
|
+
src/soiltextureplot.egg-info/SOURCES.txt
|
|
13
|
+
src/soiltextureplot.egg-info/dependency_links.txt
|
|
14
|
+
src/soiltextureplot.egg-info/requires.txt
|
|
15
|
+
src/soiltextureplot.egg-info/top_level.txt
|
|
16
|
+
src/soiltextureplot/data/example_soil_data.csv
|
|
17
|
+
tests/test_smoke.py
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import matplotlib
|
|
2
|
+
|
|
3
|
+
matplotlib.use("Agg")
|
|
4
|
+
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
import pandas as pd
|
|
7
|
+
from matplotlib.axes import Axes
|
|
8
|
+
from matplotlib.figure import Figure
|
|
9
|
+
|
|
10
|
+
from soiltextureplot import (
|
|
11
|
+
PolygonClassifier,
|
|
12
|
+
TextureSystem,
|
|
13
|
+
get_texture_system,
|
|
14
|
+
plot_triangle_with_points,
|
|
15
|
+
)
|
|
16
|
+
from soiltextureplot.systems import list_texture_systems
|
|
17
|
+
from soiltextureplot.triangle import SoilTextureTriangle
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _sample_df() -> pd.DataFrame:
|
|
21
|
+
return pd.DataFrame(
|
|
22
|
+
{
|
|
23
|
+
"sample_id": ["S1", "S2", "S3"],
|
|
24
|
+
"sand": [65.0, 70.0, 35.0],
|
|
25
|
+
"silt": [20.0, 24.0, 45.0],
|
|
26
|
+
"clay": [15.0, 6.0, 20.0],
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_imports_and_public_symbols_smoke() -> None:
|
|
32
|
+
assert PolygonClassifier is not None
|
|
33
|
+
assert TextureSystem is not None
|
|
34
|
+
assert get_texture_system is not None
|
|
35
|
+
assert plot_triangle_with_points is not None
|
|
36
|
+
assert SoilTextureTriangle is not None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_system_registry_smoke() -> None:
|
|
40
|
+
systems = list_texture_systems()
|
|
41
|
+
assert "USDA" in systems
|
|
42
|
+
assert "HYPRES" in systems
|
|
43
|
+
assert get_texture_system("USDA").name == "USDA"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_classification_smoke() -> None:
|
|
47
|
+
tri = SoilTextureTriangle(system_name="USDA").load_dataframe(_sample_df())
|
|
48
|
+
out = tri.classify()
|
|
49
|
+
assert "texture_class" in out.columns
|
|
50
|
+
assert len(out) == 3
|
|
51
|
+
assert out["texture_class"].notna().all()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_plot_smoke() -> None:
|
|
55
|
+
df = _sample_df()
|
|
56
|
+
system = get_texture_system("USDA")
|
|
57
|
+
fig, ax = plot_triangle_with_points(df=df, system=system)
|
|
58
|
+
assert isinstance(fig, Figure)
|
|
59
|
+
assert isinstance(ax, Axes)
|
|
60
|
+
plt.close(fig)
|
soiltextureplot-0.1.0/PKG-INFO
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: soiltextureplot
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Soil texture triangle plotting and classification
|
|
5
|
-
Author-email: Amninder Singh <amnindersingh13@gmail.com>
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Amninder Singh
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE OR ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
28
|
-
Project-URL: Homepage, https://github.com/singhamninder/soiltextureplot
|
|
29
|
-
Project-URL: Bug Tracker, https://github.com/singhamninder/soiltextureplot/issues
|
|
30
|
-
Keywords: soil,texture,triangle,plot,classification,ternary
|
|
31
|
-
Classifier: Development Status :: 4 - Beta
|
|
32
|
-
Classifier: Intended Audience :: Science/Research
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Programming Language :: Python :: 3
|
|
35
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
36
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
-
Classifier: Topic :: Scientific/Engineering
|
|
40
|
-
Requires-Python: >=3.9
|
|
41
|
-
Description-Content-Type: text/markdown
|
|
42
|
-
License-File: LICENSE
|
|
43
|
-
Requires-Dist: pandas>=1.5.0
|
|
44
|
-
Requires-Dist: numpy>=1.23.0
|
|
45
|
-
Requires-Dist: matplotlib>=3.7.0
|
|
46
|
-
Requires-Dist: mpltern>=1.0.0
|
|
47
|
-
Dynamic: license-file
|
|
48
|
-
|
|
49
|
-
# Soil Texture Plot
|
|
50
|
-
|
|
51
|
-
[](https://soiltextureplot.streamlit.app/)
|
|
52
|
-
|
|
53
|
-
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.
|
|
54
|
-
|
|
55
|
-
## Features
|
|
56
|
-
|
|
57
|
-
- **Ternary Plotting**: Visualize soil texture data on interactive ternary diagrams
|
|
58
|
-
- **Multiple Classification Systems**: Support for USDA and HYPRES soil texture classification systems
|
|
59
|
-
- **Interactive Web App**: Streamlit-based application for easy data upload and visualization
|
|
60
|
-
- **Flexible Data Input**: Support for CSV files with customizable column mapping
|
|
61
|
-
- **Point Classification**: Automatic classification of soil samples into texture classes
|
|
62
|
-
- **Customizable Visualization**: Control point sizes, colors, and labels
|
|
63
|
-
|
|
64
|
-
## Dependencies
|
|
65
|
-
|
|
66
|
-
- streamlit
|
|
67
|
-
- pandas
|
|
68
|
-
- numpy
|
|
69
|
-
- matplotlib
|
|
70
|
-
- mpltern
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## Web Application
|
|
74
|
-
|
|
75
|
-
The web app allows you to:
|
|
76
|
-
- Upload CSV files with soil texture data
|
|
77
|
-
- Map columns to sand, silt, and clay percentages
|
|
78
|
-
- Visualize data on interactive texture triangles
|
|
79
|
-
- Customize plot appearance
|
|
80
|
-
|
|
81
|
-
## Supported Classification Systems
|
|
82
|
-
|
|
83
|
-
### USDA (United States Department of Agriculture)
|
|
84
|
-
The standard USDA soil texture classification system with 12 texture classes.
|
|
85
|
-
|
|
86
|
-
### HYPRES (HYdraulic PRoperties of European Soils)
|
|
87
|
-
A European framework for classifying soils based on their hydrologic properties.
|
|
88
|
-
|
|
89
|
-
## Data Format
|
|
90
|
-
|
|
91
|
-
Your CSV file should contain soil texture data with percentages of sand, silt, and clay. The percentages should sum to 100% for each sample.
|
|
92
|
-
|
|
93
|
-
Example data format:
|
|
94
|
-
|
|
95
|
-
```csv
|
|
96
|
-
sample_id,sand,silt,clay
|
|
97
|
-
S1,65,20,15
|
|
98
|
-
S2,70,24,6
|
|
99
|
-
S3,75,21,4
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Acknowledgments
|
|
103
|
-
|
|
104
|
-
- Built using [mpltern](https://github.com/yuzie007/mpltern) for ternary plotting
|
|
105
|
-
- Inspired by soil science classification standards
|
|
106
|
-
- Streamlit for the web interface
|
soiltextureplot-0.1.0/README.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Soil Texture Plot
|
|
2
|
-
|
|
3
|
-
[](https://soiltextureplot.streamlit.app/)
|
|
4
|
-
|
|
5
|
-
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.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- **Ternary Plotting**: Visualize soil texture data on interactive ternary diagrams
|
|
10
|
-
- **Multiple Classification Systems**: Support for USDA and HYPRES soil texture classification systems
|
|
11
|
-
- **Interactive Web App**: Streamlit-based application for easy data upload and visualization
|
|
12
|
-
- **Flexible Data Input**: Support for CSV files with customizable column mapping
|
|
13
|
-
- **Point Classification**: Automatic classification of soil samples into texture classes
|
|
14
|
-
- **Customizable Visualization**: Control point sizes, colors, and labels
|
|
15
|
-
|
|
16
|
-
## Dependencies
|
|
17
|
-
|
|
18
|
-
- streamlit
|
|
19
|
-
- pandas
|
|
20
|
-
- numpy
|
|
21
|
-
- matplotlib
|
|
22
|
-
- mpltern
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## Web Application
|
|
26
|
-
|
|
27
|
-
The web app allows you to:
|
|
28
|
-
- Upload CSV files with soil texture data
|
|
29
|
-
- Map columns to sand, silt, and clay percentages
|
|
30
|
-
- Visualize data on interactive texture triangles
|
|
31
|
-
- Customize plot appearance
|
|
32
|
-
|
|
33
|
-
## Supported Classification Systems
|
|
34
|
-
|
|
35
|
-
### USDA (United States Department of Agriculture)
|
|
36
|
-
The standard USDA soil texture classification system with 12 texture classes.
|
|
37
|
-
|
|
38
|
-
### HYPRES (HYdraulic PRoperties of European Soils)
|
|
39
|
-
A European framework for classifying soils based on their hydrologic properties.
|
|
40
|
-
|
|
41
|
-
## Data Format
|
|
42
|
-
|
|
43
|
-
Your CSV file should contain soil texture data with percentages of sand, silt, and clay. The percentages should sum to 100% for each sample.
|
|
44
|
-
|
|
45
|
-
Example data format:
|
|
46
|
-
|
|
47
|
-
```csv
|
|
48
|
-
sample_id,sand,silt,clay
|
|
49
|
-
S1,65,20,15
|
|
50
|
-
S2,70,24,6
|
|
51
|
-
S3,75,21,4
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Acknowledgments
|
|
55
|
-
|
|
56
|
-
- Built using [mpltern](https://github.com/yuzie007/mpltern) for ternary plotting
|
|
57
|
-
- Inspired by soil science classification standards
|
|
58
|
-
- Streamlit for the web interface
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: soiltextureplot
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Soil texture triangle plotting and classification
|
|
5
|
-
Author-email: Amninder Singh <amnindersingh13@gmail.com>
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Amninder Singh
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE OR ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
28
|
-
Project-URL: Homepage, https://github.com/singhamninder/soiltextureplot
|
|
29
|
-
Project-URL: Bug Tracker, https://github.com/singhamninder/soiltextureplot/issues
|
|
30
|
-
Keywords: soil,texture,triangle,plot,classification,ternary
|
|
31
|
-
Classifier: Development Status :: 4 - Beta
|
|
32
|
-
Classifier: Intended Audience :: Science/Research
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Programming Language :: Python :: 3
|
|
35
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
36
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
-
Classifier: Topic :: Scientific/Engineering
|
|
40
|
-
Requires-Python: >=3.9
|
|
41
|
-
Description-Content-Type: text/markdown
|
|
42
|
-
License-File: LICENSE
|
|
43
|
-
Requires-Dist: pandas>=1.5.0
|
|
44
|
-
Requires-Dist: numpy>=1.23.0
|
|
45
|
-
Requires-Dist: matplotlib>=3.7.0
|
|
46
|
-
Requires-Dist: mpltern>=1.0.0
|
|
47
|
-
Dynamic: license-file
|
|
48
|
-
|
|
49
|
-
# Soil Texture Plot
|
|
50
|
-
|
|
51
|
-
[](https://soiltextureplot.streamlit.app/)
|
|
52
|
-
|
|
53
|
-
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.
|
|
54
|
-
|
|
55
|
-
## Features
|
|
56
|
-
|
|
57
|
-
- **Ternary Plotting**: Visualize soil texture data on interactive ternary diagrams
|
|
58
|
-
- **Multiple Classification Systems**: Support for USDA and HYPRES soil texture classification systems
|
|
59
|
-
- **Interactive Web App**: Streamlit-based application for easy data upload and visualization
|
|
60
|
-
- **Flexible Data Input**: Support for CSV files with customizable column mapping
|
|
61
|
-
- **Point Classification**: Automatic classification of soil samples into texture classes
|
|
62
|
-
- **Customizable Visualization**: Control point sizes, colors, and labels
|
|
63
|
-
|
|
64
|
-
## Dependencies
|
|
65
|
-
|
|
66
|
-
- streamlit
|
|
67
|
-
- pandas
|
|
68
|
-
- numpy
|
|
69
|
-
- matplotlib
|
|
70
|
-
- mpltern
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## Web Application
|
|
74
|
-
|
|
75
|
-
The web app allows you to:
|
|
76
|
-
- Upload CSV files with soil texture data
|
|
77
|
-
- Map columns to sand, silt, and clay percentages
|
|
78
|
-
- Visualize data on interactive texture triangles
|
|
79
|
-
- Customize plot appearance
|
|
80
|
-
|
|
81
|
-
## Supported Classification Systems
|
|
82
|
-
|
|
83
|
-
### USDA (United States Department of Agriculture)
|
|
84
|
-
The standard USDA soil texture classification system with 12 texture classes.
|
|
85
|
-
|
|
86
|
-
### HYPRES (HYdraulic PRoperties of European Soils)
|
|
87
|
-
A European framework for classifying soils based on their hydrologic properties.
|
|
88
|
-
|
|
89
|
-
## Data Format
|
|
90
|
-
|
|
91
|
-
Your CSV file should contain soil texture data with percentages of sand, silt, and clay. The percentages should sum to 100% for each sample.
|
|
92
|
-
|
|
93
|
-
Example data format:
|
|
94
|
-
|
|
95
|
-
```csv
|
|
96
|
-
sample_id,sand,silt,clay
|
|
97
|
-
S1,65,20,15
|
|
98
|
-
S2,70,24,6
|
|
99
|
-
S3,75,21,4
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Acknowledgments
|
|
103
|
-
|
|
104
|
-
- Built using [mpltern](https://github.com/yuzie007/mpltern) for ternary plotting
|
|
105
|
-
- Inspired by soil science classification standards
|
|
106
|
-
- Streamlit for the web interface
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
soiltextureplot/__init__.py
|
|
5
|
-
soiltextureplot/classifier.py
|
|
6
|
-
soiltextureplot/datasets.py
|
|
7
|
-
soiltextureplot/plotting.py
|
|
8
|
-
soiltextureplot/systems.py
|
|
9
|
-
soiltextureplot/triangle.py
|
|
10
|
-
soiltextureplot/utils.py
|
|
11
|
-
soiltextureplot.egg-info/PKG-INFO
|
|
12
|
-
soiltextureplot.egg-info/SOURCES.txt
|
|
13
|
-
soiltextureplot.egg-info/dependency_links.txt
|
|
14
|
-
soiltextureplot.egg-info/requires.txt
|
|
15
|
-
soiltextureplot.egg-info/top_level.txt
|
|
File without changes
|
|
File without changes
|
|
@@ -21,8 +21,8 @@ utils
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
from .classifier import PolygonClassifier
|
|
24
|
-
from .systems import TextureSystem, get_texture_system
|
|
25
24
|
from .plotting import plot_triangle_with_points
|
|
25
|
+
from .systems import TextureSystem, get_texture_system
|
|
26
26
|
|
|
27
27
|
__all__ = [
|
|
28
28
|
"PolygonClassifier",
|
{soiltextureplot-0.1.0 → soiltextureplot-0.1.3/src}/soiltextureplot.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|