terrangraph 0.1.0__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.
- terrangraph-0.1.0/PKG-INFO +265 -0
- terrangraph-0.1.0/README.md +222 -0
- terrangraph-0.1.0/pyproject.toml +86 -0
- terrangraph-0.1.0/setup.cfg +4 -0
- terrangraph-0.1.0/src/terrangraph/__init__.py +69 -0
- terrangraph-0.1.0/src/terrangraph/cli.py +233 -0
- terrangraph-0.1.0/src/terrangraph/core/__init__.py +19 -0
- terrangraph-0.1.0/src/terrangraph/core/data_handler.py +262 -0
- terrangraph-0.1.0/src/terrangraph/core/geo_model.py +329 -0
- terrangraph-0.1.0/src/terrangraph/core/visualizer.py +266 -0
- terrangraph-0.1.0/src/terrangraph.egg-info/PKG-INFO +265 -0
- terrangraph-0.1.0/src/terrangraph.egg-info/SOURCES.txt +14 -0
- terrangraph-0.1.0/src/terrangraph.egg-info/dependency_links.txt +1 -0
- terrangraph-0.1.0/src/terrangraph.egg-info/entry_points.txt +2 -0
- terrangraph-0.1.0/src/terrangraph.egg-info/requires.txt +21 -0
- terrangraph-0.1.0/src/terrangraph.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: terrangraph
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A graph-based framework for geotechnical site representation and subsurface intelligence
|
|
5
|
+
Author-email: Wang Lai <wanglai@imust.edu.cn>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/wanglai25/terrangraph
|
|
8
|
+
Project-URL: Source, https://github.com/wanglai25/terrangraph
|
|
9
|
+
Project-URL: Issues, https://github.com/wanglai25/terrangraph/issues
|
|
10
|
+
Keywords: geotechnical,subsurface,graph-learning,graph-neural-networks,site-characterization,representation-learning
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: numpy>=1.20
|
|
26
|
+
Requires-Dist: pandas>=1.0
|
|
27
|
+
Requires-Dist: scipy>=1.5
|
|
28
|
+
Requires-Dist: scikit-learn>=0.24
|
|
29
|
+
Requires-Dist: tqdm>=4.40
|
|
30
|
+
Provides-Extra: ml
|
|
31
|
+
Requires-Dist: torch>=1.9; extra == "ml"
|
|
32
|
+
Requires-Dist: torch-geometric>=2.0; extra == "ml"
|
|
33
|
+
Provides-Extra: viz
|
|
34
|
+
Requires-Dist: matplotlib>=3.0; extra == "viz"
|
|
35
|
+
Requires-Dist: pyvista>=0.30; extra == "viz"
|
|
36
|
+
Requires-Dist: pillow>=8.0; extra == "viz"
|
|
37
|
+
Provides-Extra: all
|
|
38
|
+
Requires-Dist: torch>=1.9; extra == "all"
|
|
39
|
+
Requires-Dist: torch-geometric>=2.0; extra == "all"
|
|
40
|
+
Requires-Dist: matplotlib>=3.0; extra == "all"
|
|
41
|
+
Requires-Dist: pyvista>=0.30; extra == "all"
|
|
42
|
+
Requires-Dist: pillow>=8.0; extra == "all"
|
|
43
|
+
|
|
44
|
+
# TerranGraph: A Graph-Based Framework for Geotechnical Site Representation
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<img src="https://raw.githubusercontent.com/wanglai25/terrangraph/main/assets/banner.png" alt="TerranGraph banner" width="100%">
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
<p align="center">
|
|
51
|
+
<b>TerranGraph — A unified graph learning framework for subsurface intelligence.</b>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<p align="center">
|
|
55
|
+
<a href="https://pypi.org/project/terrangraph/">
|
|
56
|
+
<img src="https://img.shields.io/pypi/v/terrangraph.svg" alt="PyPI version">
|
|
57
|
+
</a>
|
|
58
|
+
|
|
59
|
+
<a href="https://pypi.org/project/terrangraph/">
|
|
60
|
+
<img src="https://img.shields.io/pypi/pyversions/terrangraph.svg" alt="Python version">
|
|
61
|
+
</a>
|
|
62
|
+
|
|
63
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
64
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT">
|
|
65
|
+
</a>
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
TerranGraph is a Python framework for geotechnical site representation, learning, and visualization. It integrates multi-source data processing, spatial graph construction, graph neural networks, and 3D visualization into a single workflow for subsurface modeling and prediction.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Overview
|
|
73
|
+
|
|
74
|
+
TerranGraph follows an end-to-end workflow:
|
|
75
|
+
|
|
76
|
+
**Geotechnical Data → Spatial Graph → Representation Learning → Prediction → Visualization**
|
|
77
|
+
|
|
78
|
+
Designed for subsurface modeling and site characterization, TerranGraph bridges geotechnical data and graph-based intelligence.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Features
|
|
83
|
+
|
|
84
|
+
- **Multi-source data integration** for Excel and CSV geotechnical datasets
|
|
85
|
+
- **Spatial graph construction** from borehole logs and spatial coordinates
|
|
86
|
+
- **Graph neural networks** for site representation learning and prediction
|
|
87
|
+
- **3D visualization** with PyVista for subsurface modeling and cross-section analysis
|
|
88
|
+
- **Interactive GUI** based on PyQt5 for workflow exploration
|
|
89
|
+
- **Scalable training** with PyTorch and optional GPU acceleration
|
|
90
|
+
- **Model export** to standard 3D formats such as PLY, OBJ, and STL
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Installation
|
|
95
|
+
|
|
96
|
+
Install the lightweight core package:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install terrangraph
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Install with graph learning support:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install terrangraph[ml]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Install with visualization support:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pip install terrangraph[viz]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Install full features:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip install terrangraph[all]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Quick Start
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from terrangraph import DataHandler, GeoModel, GeoVisualizer
|
|
124
|
+
|
|
125
|
+
# Load geotechnical data
|
|
126
|
+
handler = DataHandler()
|
|
127
|
+
unique_types, num_classes = handler.load_data("your_dataset.xlsx")
|
|
128
|
+
|
|
129
|
+
# Preprocess and align coordinates
|
|
130
|
+
rect = handler.compute_mbr()
|
|
131
|
+
bounds = handler.align_coordinates(x_res=10, y_res=2, z_res=1)
|
|
132
|
+
params_dict = handler.create_param_dict()
|
|
133
|
+
|
|
134
|
+
# Construct spatial graph
|
|
135
|
+
coords, labels, edges = handler.generate_grid(bounds, r=2)
|
|
136
|
+
|
|
137
|
+
# Train graph neural network
|
|
138
|
+
model = GeoModel()
|
|
139
|
+
model.prepare_data(coords, labels, edges)
|
|
140
|
+
model.build_model(
|
|
141
|
+
num_classes=num_classes,
|
|
142
|
+
hidden_size=48,
|
|
143
|
+
gcn_layers=3,
|
|
144
|
+
mlp_layers=3,
|
|
145
|
+
dropout=0.2
|
|
146
|
+
)
|
|
147
|
+
history = model.train(epochs=100, lr=3e-3)
|
|
148
|
+
|
|
149
|
+
# Prediction and visualization
|
|
150
|
+
predictions, probabilities = model.predict()
|
|
151
|
+
visualizer = GeoVisualizer()
|
|
152
|
+
mesh = visualizer.create_model(coords, predictions)
|
|
153
|
+
visualizer.show_model(mesh)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Input Data Format
|
|
157
|
+
|
|
158
|
+
The input dataset should include:
|
|
159
|
+
|
|
160
|
+
- `X`, `Y`, `Z`: spatial coordinates
|
|
161
|
+
- `Soil/Rock Type`: soil or rock type classification
|
|
162
|
+
- `Borehole ID`: borehole identifier (optional)
|
|
163
|
+
- `Borehole Type`: borehole category (optional)
|
|
164
|
+
|
|
165
|
+
Additional geotechnical parameters (e.g., strength, density, CPT measurements, etc.) can be incorporated for extended modeling tasks.
|
|
166
|
+
|
|
167
|
+
## Use Cases
|
|
168
|
+
|
|
169
|
+
TerranGraph can be used for:
|
|
170
|
+
|
|
171
|
+
- 3D subsurface modeling
|
|
172
|
+
- Borehole-based site characterization
|
|
173
|
+
- Graph-based representation learning of geotechnical data
|
|
174
|
+
- Similarity-based site comparison and clustering
|
|
175
|
+
- Data-driven prediction of soil and rock properties
|
|
176
|
+
|
|
177
|
+
## Project Structure
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
terrangraph/
|
|
181
|
+
├── src/
|
|
182
|
+
│ └── terrangraph/
|
|
183
|
+
│ ├── __init__.py # Package exports
|
|
184
|
+
│ ├── cli.py # Command-line interface
|
|
185
|
+
│ └── core/
|
|
186
|
+
│ ├── __init__.py
|
|
187
|
+
│ ├── data_handler.py # Data loading and preprocessing
|
|
188
|
+
│ ├── geo_model.py # Graph neural network models
|
|
189
|
+
│ └── visualizer.py # 3D visualization (PyVista)
|
|
190
|
+
│
|
|
191
|
+
├── assets/ # Logo and banner images
|
|
192
|
+
├── docs/ # Documentation files
|
|
193
|
+
├── CHANGELOG.md # Version history
|
|
194
|
+
├── LICENSE # License
|
|
195
|
+
├── pyproject.toml # Package configuration
|
|
196
|
+
└── README.md # Project documentation
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Examples
|
|
200
|
+
|
|
201
|
+
See the [examples/](examples/) directory:
|
|
202
|
+
|
|
203
|
+
- `basic_usage.py`: basic workflow
|
|
204
|
+
- `advanced_visualization.py`: advanced visualization
|
|
205
|
+
- `batch_processing.py`: batch processing
|
|
206
|
+
- `custom_model.py`: custom GNN architectures
|
|
207
|
+
|
|
208
|
+
## Documentation
|
|
209
|
+
|
|
210
|
+
- [Installation Guide](docs/installation.md)
|
|
211
|
+
- [API Reference](docs/api.md)
|
|
212
|
+
- [User Tutorial](docs/tutorial.md)
|
|
213
|
+
- [Developer Guide](docs/development.md)
|
|
214
|
+
|
|
215
|
+
## System Requirements
|
|
216
|
+
|
|
217
|
+
- Python 3.8+
|
|
218
|
+
- 8GB RAM minimum (16GB recommended)
|
|
219
|
+
- CUDA-compatible GPU (required for `ml`)
|
|
220
|
+
- OpenGL support for 3D visualization (required for `viz`)
|
|
221
|
+
|
|
222
|
+
## Roadmap
|
|
223
|
+
|
|
224
|
+
### Current Capabilities
|
|
225
|
+
|
|
226
|
+
- [x] Graph-based geotechnical site representation
|
|
227
|
+
- [x] Spatial graph construction from borehole data
|
|
228
|
+
- [x] GNN-based prediction framework
|
|
229
|
+
- [x] 3D subsurface visualization (PyVista)
|
|
230
|
+
|
|
231
|
+
### Next Steps
|
|
232
|
+
|
|
233
|
+
- [ ] Integration of additional geotechnical parameters (e.g., CPT, strength, density)
|
|
234
|
+
- [ ] Integration of real-time monitoring data (e.g., tunneling operation data)
|
|
235
|
+
- [ ] Contrastive learning for site similarity analysis
|
|
236
|
+
- [ ] Support for large-scale geotechnical datasets
|
|
237
|
+
- [ ] Probabilistic modeling and uncertainty quantification
|
|
238
|
+
|
|
239
|
+
## Contributing
|
|
240
|
+
|
|
241
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
|
|
245
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
246
|
+
|
|
247
|
+
## Citation
|
|
248
|
+
|
|
249
|
+
If you use TerranGraph in your research, please cite:
|
|
250
|
+
|
|
251
|
+
```bibtex
|
|
252
|
+
@software{wang2026terrangraph,
|
|
253
|
+
author = {Wang, Lai},
|
|
254
|
+
title = {TerranGraph: A Graph-Based Framework for Geotechnical Site Representation},
|
|
255
|
+
year = {2026},
|
|
256
|
+
version = {0.1.0},
|
|
257
|
+
url = {https://github.com/wanglai25/terrangraph}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Support
|
|
262
|
+
|
|
263
|
+
- Email: <wanglai@imust.edu.cn>
|
|
264
|
+
- Issues: [GitHub Issues](https://github.com/wanglai25/terrangraph/issues)
|
|
265
|
+
- Discussions: [GitHub Discussions](https://github.com/wanglai25/terrangraph/discussions)
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# TerranGraph: A Graph-Based Framework for Geotechnical Site Representation
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/wanglai25/terrangraph/main/assets/banner.png" alt="TerranGraph banner" width="100%">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>TerranGraph — A unified graph learning framework for subsurface intelligence.</b>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://pypi.org/project/terrangraph/">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/terrangraph.svg" alt="PyPI version">
|
|
14
|
+
</a>
|
|
15
|
+
|
|
16
|
+
<a href="https://pypi.org/project/terrangraph/">
|
|
17
|
+
<img src="https://img.shields.io/pypi/pyversions/terrangraph.svg" alt="Python version">
|
|
18
|
+
</a>
|
|
19
|
+
|
|
20
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
21
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT">
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
TerranGraph is a Python framework for geotechnical site representation, learning, and visualization. It integrates multi-source data processing, spatial graph construction, graph neural networks, and 3D visualization into a single workflow for subsurface modeling and prediction.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Overview
|
|
30
|
+
|
|
31
|
+
TerranGraph follows an end-to-end workflow:
|
|
32
|
+
|
|
33
|
+
**Geotechnical Data → Spatial Graph → Representation Learning → Prediction → Visualization**
|
|
34
|
+
|
|
35
|
+
Designed for subsurface modeling and site characterization, TerranGraph bridges geotechnical data and graph-based intelligence.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- **Multi-source data integration** for Excel and CSV geotechnical datasets
|
|
42
|
+
- **Spatial graph construction** from borehole logs and spatial coordinates
|
|
43
|
+
- **Graph neural networks** for site representation learning and prediction
|
|
44
|
+
- **3D visualization** with PyVista for subsurface modeling and cross-section analysis
|
|
45
|
+
- **Interactive GUI** based on PyQt5 for workflow exploration
|
|
46
|
+
- **Scalable training** with PyTorch and optional GPU acceleration
|
|
47
|
+
- **Model export** to standard 3D formats such as PLY, OBJ, and STL
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
Install the lightweight core package:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install terrangraph
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Install with graph learning support:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install terrangraph[ml]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Install with visualization support:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install terrangraph[viz]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Install full features:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install terrangraph[all]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Quick Start
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from terrangraph import DataHandler, GeoModel, GeoVisualizer
|
|
81
|
+
|
|
82
|
+
# Load geotechnical data
|
|
83
|
+
handler = DataHandler()
|
|
84
|
+
unique_types, num_classes = handler.load_data("your_dataset.xlsx")
|
|
85
|
+
|
|
86
|
+
# Preprocess and align coordinates
|
|
87
|
+
rect = handler.compute_mbr()
|
|
88
|
+
bounds = handler.align_coordinates(x_res=10, y_res=2, z_res=1)
|
|
89
|
+
params_dict = handler.create_param_dict()
|
|
90
|
+
|
|
91
|
+
# Construct spatial graph
|
|
92
|
+
coords, labels, edges = handler.generate_grid(bounds, r=2)
|
|
93
|
+
|
|
94
|
+
# Train graph neural network
|
|
95
|
+
model = GeoModel()
|
|
96
|
+
model.prepare_data(coords, labels, edges)
|
|
97
|
+
model.build_model(
|
|
98
|
+
num_classes=num_classes,
|
|
99
|
+
hidden_size=48,
|
|
100
|
+
gcn_layers=3,
|
|
101
|
+
mlp_layers=3,
|
|
102
|
+
dropout=0.2
|
|
103
|
+
)
|
|
104
|
+
history = model.train(epochs=100, lr=3e-3)
|
|
105
|
+
|
|
106
|
+
# Prediction and visualization
|
|
107
|
+
predictions, probabilities = model.predict()
|
|
108
|
+
visualizer = GeoVisualizer()
|
|
109
|
+
mesh = visualizer.create_model(coords, predictions)
|
|
110
|
+
visualizer.show_model(mesh)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Input Data Format
|
|
114
|
+
|
|
115
|
+
The input dataset should include:
|
|
116
|
+
|
|
117
|
+
- `X`, `Y`, `Z`: spatial coordinates
|
|
118
|
+
- `Soil/Rock Type`: soil or rock type classification
|
|
119
|
+
- `Borehole ID`: borehole identifier (optional)
|
|
120
|
+
- `Borehole Type`: borehole category (optional)
|
|
121
|
+
|
|
122
|
+
Additional geotechnical parameters (e.g., strength, density, CPT measurements, etc.) can be incorporated for extended modeling tasks.
|
|
123
|
+
|
|
124
|
+
## Use Cases
|
|
125
|
+
|
|
126
|
+
TerranGraph can be used for:
|
|
127
|
+
|
|
128
|
+
- 3D subsurface modeling
|
|
129
|
+
- Borehole-based site characterization
|
|
130
|
+
- Graph-based representation learning of geotechnical data
|
|
131
|
+
- Similarity-based site comparison and clustering
|
|
132
|
+
- Data-driven prediction of soil and rock properties
|
|
133
|
+
|
|
134
|
+
## Project Structure
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
terrangraph/
|
|
138
|
+
├── src/
|
|
139
|
+
│ └── terrangraph/
|
|
140
|
+
│ ├── __init__.py # Package exports
|
|
141
|
+
│ ├── cli.py # Command-line interface
|
|
142
|
+
│ └── core/
|
|
143
|
+
│ ├── __init__.py
|
|
144
|
+
│ ├── data_handler.py # Data loading and preprocessing
|
|
145
|
+
│ ├── geo_model.py # Graph neural network models
|
|
146
|
+
│ └── visualizer.py # 3D visualization (PyVista)
|
|
147
|
+
│
|
|
148
|
+
├── assets/ # Logo and banner images
|
|
149
|
+
├── docs/ # Documentation files
|
|
150
|
+
├── CHANGELOG.md # Version history
|
|
151
|
+
├── LICENSE # License
|
|
152
|
+
├── pyproject.toml # Package configuration
|
|
153
|
+
└── README.md # Project documentation
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Examples
|
|
157
|
+
|
|
158
|
+
See the [examples/](examples/) directory:
|
|
159
|
+
|
|
160
|
+
- `basic_usage.py`: basic workflow
|
|
161
|
+
- `advanced_visualization.py`: advanced visualization
|
|
162
|
+
- `batch_processing.py`: batch processing
|
|
163
|
+
- `custom_model.py`: custom GNN architectures
|
|
164
|
+
|
|
165
|
+
## Documentation
|
|
166
|
+
|
|
167
|
+
- [Installation Guide](docs/installation.md)
|
|
168
|
+
- [API Reference](docs/api.md)
|
|
169
|
+
- [User Tutorial](docs/tutorial.md)
|
|
170
|
+
- [Developer Guide](docs/development.md)
|
|
171
|
+
|
|
172
|
+
## System Requirements
|
|
173
|
+
|
|
174
|
+
- Python 3.8+
|
|
175
|
+
- 8GB RAM minimum (16GB recommended)
|
|
176
|
+
- CUDA-compatible GPU (required for `ml`)
|
|
177
|
+
- OpenGL support for 3D visualization (required for `viz`)
|
|
178
|
+
|
|
179
|
+
## Roadmap
|
|
180
|
+
|
|
181
|
+
### Current Capabilities
|
|
182
|
+
|
|
183
|
+
- [x] Graph-based geotechnical site representation
|
|
184
|
+
- [x] Spatial graph construction from borehole data
|
|
185
|
+
- [x] GNN-based prediction framework
|
|
186
|
+
- [x] 3D subsurface visualization (PyVista)
|
|
187
|
+
|
|
188
|
+
### Next Steps
|
|
189
|
+
|
|
190
|
+
- [ ] Integration of additional geotechnical parameters (e.g., CPT, strength, density)
|
|
191
|
+
- [ ] Integration of real-time monitoring data (e.g., tunneling operation data)
|
|
192
|
+
- [ ] Contrastive learning for site similarity analysis
|
|
193
|
+
- [ ] Support for large-scale geotechnical datasets
|
|
194
|
+
- [ ] Probabilistic modeling and uncertainty quantification
|
|
195
|
+
|
|
196
|
+
## Contributing
|
|
197
|
+
|
|
198
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
203
|
+
|
|
204
|
+
## Citation
|
|
205
|
+
|
|
206
|
+
If you use TerranGraph in your research, please cite:
|
|
207
|
+
|
|
208
|
+
```bibtex
|
|
209
|
+
@software{wang2026terrangraph,
|
|
210
|
+
author = {Wang, Lai},
|
|
211
|
+
title = {TerranGraph: A Graph-Based Framework for Geotechnical Site Representation},
|
|
212
|
+
year = {2026},
|
|
213
|
+
version = {0.1.0},
|
|
214
|
+
url = {https://github.com/wanglai25/terrangraph}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Support
|
|
219
|
+
|
|
220
|
+
- Email: <wanglai@imust.edu.cn>
|
|
221
|
+
- Issues: [GitHub Issues](https://github.com/wanglai25/terrangraph/issues)
|
|
222
|
+
- Discussions: [GitHub Discussions](https://github.com/wanglai25/terrangraph/discussions)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "terrangraph"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "A graph-based framework for geotechnical site representation and subsurface intelligence"
|
|
9
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Wang Lai", email = "wanglai@imust.edu.cn" },
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Topic :: Scientific/Engineering",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.8",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
keywords = [
|
|
32
|
+
"geotechnical",
|
|
33
|
+
"subsurface",
|
|
34
|
+
"graph-learning",
|
|
35
|
+
"graph-neural-networks",
|
|
36
|
+
"site-characterization",
|
|
37
|
+
"representation-learning",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
requires-python = ">=3.8"
|
|
41
|
+
|
|
42
|
+
dependencies = [
|
|
43
|
+
"numpy>=1.20",
|
|
44
|
+
"pandas>=1.0",
|
|
45
|
+
"scipy>=1.5",
|
|
46
|
+
"scikit-learn>=0.24",
|
|
47
|
+
"tqdm>=4.40",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.optional-dependencies]
|
|
51
|
+
|
|
52
|
+
ml = [
|
|
53
|
+
"torch>=1.9",
|
|
54
|
+
"torch-geometric>=2.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
viz = [
|
|
58
|
+
"matplotlib>=3.0",
|
|
59
|
+
"pyvista>=0.30",
|
|
60
|
+
"pillow>=8.0",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
# full install
|
|
64
|
+
all = [
|
|
65
|
+
"torch>=1.9",
|
|
66
|
+
"torch-geometric>=2.0",
|
|
67
|
+
"matplotlib>=3.0",
|
|
68
|
+
"pyvista>=0.30",
|
|
69
|
+
"pillow>=8.0",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[project.urls]
|
|
73
|
+
Homepage = "https://github.com/wanglai25/terrangraph"
|
|
74
|
+
Source = "https://github.com/wanglai25/terrangraph"
|
|
75
|
+
Issues = "https://github.com/wanglai25/terrangraph/issues"
|
|
76
|
+
|
|
77
|
+
[project.scripts]
|
|
78
|
+
terrangraph = "terrangraph.cli:main"
|
|
79
|
+
|
|
80
|
+
[tool.setuptools]
|
|
81
|
+
package-dir = { "" = "src" }
|
|
82
|
+
packages = { find = { where = ["src"], include = ["terrangraph*"] } }
|
|
83
|
+
include-package-data = true
|
|
84
|
+
|
|
85
|
+
[tool.setuptools.dynamic]
|
|
86
|
+
version = { attr = "terrangraph.__version__" }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TerranGraph - Graph-Based Geotechnical Site Representation
|
|
3
|
+
========================================================
|
|
4
|
+
|
|
5
|
+
TerranGraph is a Python framework for graph-based learning of geotechnical site
|
|
6
|
+
representation and subsurface modeling. It integrates multi-source geotechnical
|
|
7
|
+
data processing, spatial graph construction, graph neural networks, and 3D
|
|
8
|
+
visualization into a unified workflow for subsurface characterization and prediction.
|
|
9
|
+
|
|
10
|
+
Main Components:
|
|
11
|
+
- DataHandler: Data loading and preprocessing for geotechnical data
|
|
12
|
+
- GeoModel: Graph neural network modeling for site representation learning
|
|
13
|
+
- GeoVisualizer: 3D visualization using PyVista
|
|
14
|
+
- CLI: Command-line interface for workflow execution
|
|
15
|
+
- GUI: PyQt5-based interactive interface (optional)
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
>>> from terrangraph import DataHandler, GeoModel, GeoVisualizer
|
|
19
|
+
>>>
|
|
20
|
+
>>> # Load and process data
|
|
21
|
+
>>> handler = DataHandler()
|
|
22
|
+
>>> handler.load_data("geotechnical_data.xlsx")
|
|
23
|
+
>>>
|
|
24
|
+
>>> # Generate spatial graph
|
|
25
|
+
>>> coords, labels, edges = handler.generate_grid()
|
|
26
|
+
>>>
|
|
27
|
+
>>> # Train model
|
|
28
|
+
>>> model = GeoModel()
|
|
29
|
+
>>> model.prepare_data(coords, labels, edges)
|
|
30
|
+
>>> model.build_model(num_classes=5)
|
|
31
|
+
>>> model.train(epochs=100)
|
|
32
|
+
>>>
|
|
33
|
+
>>> # Visualize results
|
|
34
|
+
>>> visualizer = GeoVisualizer()
|
|
35
|
+
>>> predictions, _ = model.predict()
|
|
36
|
+
>>> mesh = visualizer.create_model(coords, predictions)
|
|
37
|
+
>>> visualizer.show_model(mesh)
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
__version__ = "0.1.0"
|
|
41
|
+
__author__ = "Wang Lai"
|
|
42
|
+
__email__ = "wanglai@imust.edu.cn"
|
|
43
|
+
__license__ = "MIT"
|
|
44
|
+
|
|
45
|
+
# Core components
|
|
46
|
+
from .core.data_handler import DataHandler
|
|
47
|
+
from .core.geo_model import GeoModel, GNN
|
|
48
|
+
from .core.visualizer import GeoVisualizer
|
|
49
|
+
|
|
50
|
+
# Command line interface
|
|
51
|
+
from .cli import main as cli_main
|
|
52
|
+
|
|
53
|
+
# Public API
|
|
54
|
+
__all__ = [
|
|
55
|
+
# Version info
|
|
56
|
+
'__version__', '__author__', '__email__', '__license__',
|
|
57
|
+
|
|
58
|
+
# Core classes
|
|
59
|
+
'DataHandler', 'GeoModel', 'GNN', 'GeoVisualizer',
|
|
60
|
+
|
|
61
|
+
# Utilities
|
|
62
|
+
'validate_data_format', 'estimate_memory_usage', 'optimize_parameters',
|
|
63
|
+
|
|
64
|
+
# CLI
|
|
65
|
+
'cli_main',
|
|
66
|
+
|
|
67
|
+
# GUI availability
|
|
68
|
+
'GUI_AVAILABLE',
|
|
69
|
+
]
|