Skip to main content

Synthetic trench scenario generator bundle (surfaces + volumetrics).

Project description

Trenchfoot

Surface and volumetric trench mesh generator with shipped presets, Plotly previews, and a lightweight Python SDK.

Install

pip install trenchfoot

Want volumetrics or visualisations? Install extras as needed:

  • pip install "trenchfoot[mesher]" for gmsh-powered volume meshes.
  • pip install "trenchfoot[preview]" for matplotlib snapshot renders.
  • pip install "trenchfoot[viz]" for Plotly HTML viewers.

Scenario Gallery

Color key: trench surfaces use warm soil tones; embedded geometry is colour-coded per group.

Scenario Top Side Oblique
S01_straight_vwalls S01 top S01 side S01 oblique
S02_straight_slope_pipe S02 top S02 side S02 oblique
S03_L_slope_two_pipes_box S03 top S03 side S03 oblique
S04_U_slope_multi_noise S04 top S04 side S04 oblique
S05_wide_slope_pair S05 top S05 side S05 oblique
S06_bumpy_wide_loop S06 top S06 side S06 oblique
S07_circular_well S07 top S07 side S07 oblique

S07 circular well preset

A deep cylindrical well with criss-crossing pipes at different elevations:

{
  "path_xy": "<<32-vertex circle approximation, radius=1.5>>",
  "width": 2.0,
  "depth": 2.5,
  "wall_slope": 0.05,
  "ground": {"z0": 0.0, "slope": [0.0, 0.0], "size_margin": 2.0},
  "pipes": [
    {"radius": 0.20, "length": 4.0, "angle_deg": 0, "s_center": 0.25, "z": -0.5},
    {"radius": 0.15, "length": 3.5, "angle_deg": 45, "s_center": 0.5, "z": -1.2},
    {"radius": 0.10, "length": 3.0, "angle_deg": -60, "s_center": 0.75, "z": -1.8},
    {"radius": 0.12, "length": 3.2, "angle_deg": 90, "s_center": 0.0, "z": -2.2}
  ],
  "spheres": [{"radius": 0.25, "s": 0.4, "z": -1.5}],
  "noise": {"enable": true, "amplitude": 0.02, "corr_length": 0.4, "octaves": 2, "gain": 0.5}
}

CLI quick start

trenchfoot-generate --help
trenchfoot-generate --preview --skip-volumetric --gallery docs/scenario_gallery.md
trenchfoot-plot packages/trenchfoot/scenarios/S05_wide_slope_pair/trench_scene.obj --open

Set TRENCHFOOT_SCENARIO_OUT_ROOT=/tmp/trench-previews (or another writable path) to keep generated assets out of your checkout.

Python API

from trenchfoot import scene_spec_from_dict, generate_surface_mesh, generate_trench_volume, gmsh_available

spec_dict = {
    "path_xy": [[0.0, 0.0], [5.0, 0.0]],
    "width": 1.0,
    "depth": 1.2,
    "pipes": [{"radius": 0.1, "length": 1.8, "angle_deg": 0.0, "s_center": 0.5}],
    "boxes": [],
    "spheres": [],
    "noise": {"enable": False},
}

scene = scene_spec_from_dict(spec_dict)
surface = generate_surface_mesh(scene, make_preview=True)
surface.persist("./surface")

if gmsh_available():
    volume = generate_trench_volume(spec_dict, lc=0.4, persist_path="./volume/trench_volume.msh")

SurfaceMeshResult keeps per-group faces, metrics, and optional preview PNG bytes; call .persist(...) when you need files. VolumeMeshResult exposes node coordinates, elements, and physical groups while still letting you stay in memory.

Testing

pytest -rs

The suite exercises each preset (surface + volumetric), the gallery helpers, and the SDK smoke paths.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trenchfoot-0.2.2.tar.gz (6.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trenchfoot-0.2.2-py3-none-any.whl (6.9 MB view details)

Uploaded Python 3

File details

Details for the file trenchfoot-0.2.2.tar.gz.

File metadata

  • Download URL: trenchfoot-0.2.2.tar.gz
  • Upload date:
  • Size: 6.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for trenchfoot-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e3fd08fe4b0adad2f875bd6c74aae1e8cab124986c417cd1cec7d984c9afcb57
MD5 a5081b6c6442aa734cae9b5b64f4c19c
BLAKE2b-256 f5b7bc7f4a7bdc07c508bc04f0193ff20a9c8460be0ba5fff44d40dcc67d844a

See more details on using hashes here.

File details

Details for the file trenchfoot-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: trenchfoot-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for trenchfoot-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b17b16340a7405cb7ac5ea8d17c7e8c306de71ec65e0fb819c2d95a575471b72
MD5 225cb40229ef0684210f95d29634e85b
BLAKE2b-256 ebd972ff5a9f81bbf9b44b1a965930b456a850412f0f021cb43d306d834f5185

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page