Generate oceanographic mooring diagrams from YAML configuration files.
python -m venv venv
source venv/bin/activate # activate before installing or running
pip install -r requirements.txt
pip install -e . # install the moordiag CLIThe package installs a moordiag command with four subcommands.
Shows every component (shackles, ropes, floats, instruments, anchor) with HAB-based spacing so vertical positions reflect actual depths.
moordiag hardware config/dsK2_manual.mooring.yaml
moordiag hardware config/dsK2_manual.mooring.yaml -o output_dir
moordiag hardware config/dsK2_manual.mooring.yaml --hab
moordiag hardware config/dsK2_manual.mooring.yaml --dpi 150Options:
| Flag | Default | Description |
|---|---|---|
-o, --output-dir |
diagrams/ |
Output directory |
--hab / --no-hab |
on | Show height-above-bottom labels (use --no-hab for depth) |
--dpi |
300 | Output resolution |
--debug |
off | Print layout debug info |
Output: <output_dir>/<mooring_name>.pdf (A4 pages assembled from sliced chunks)
Shows instruments, floats, release, and anchor stacked by image size. Rope lengths do not affect spacing — useful for a compact at-a-glance view.
moordiag single config/dsK2_manual.mooring.yaml
moordiag single config/dsK2_manual.mooring.yaml -o output_dir
moordiag single config/dsK2_manual.mooring.yaml --no-habOptions:
| Flag | Default | Description |
|---|---|---|
-o, --output-dir |
diagrams/ |
Output directory |
--hab / --no-hab |
on | Show height-above-bottom labels |
--dpi |
300 | Output resolution |
--debug |
off | Print layout debug info |
Output: <output_dir>/<mooring_name>_single.pdf
Renders all moorings in an array config side-by-side on an A3 landscape page, with a metadata table (coordinates, waterdepth, instrument counts) below each.
moordiag array config/dsTriangles_2026.array.yaml
moordiag array config/dsTriangles_2026.array.yaml -o output_dir
moordiag array config/dsTriangles_2026.array.yaml --no-hab
moordiag array config/dsTriangles_2026.array.yaml --enrichOptions:
| Flag | Default | Description |
|---|---|---|
-o, --output-dir |
diagrams/ |
Output directory |
--hab / --no-hab |
on | Show HAB labels; --no-hab shows depth (waterdepth − hab) |
--dpi |
300 | Output resolution |
--enrich |
off | Re-run enrichment even if enriched files already exist |
Output: <output_dir>/<array_name>_array.pdf
Walks the inline: elements of a mooring config from anchor upward, accumulating
the physical length of each component (shackles, ropes, floats, etc.) to compute
where each element sits relative to the seabed. Adds hab_bottom and hab_top to
every inline element and writes the result as *_enriched.yaml.
clamp: instruments already carry explicit hab: values and pass through unchanged.
The enriched file is what all diagram generators use — the drawing code needs absolute vertical positions to place elements correctly, and those only exist after enrichment.
moordiag enrich config/dsK1_manual.mooring.yaml
moordiag enrich config/ds*_manual.mooring.yaml # multiple files
moordiag enrich config/dsK1_manual.mooring.yaml -o enriched_dirOptions:
| Flag | Default | Description |
|---|---|---|
-o, --output-dir |
same dir as source | Write enriched files here instead of alongside source |
Output: <source_dir>/<config_stem>_enriched.mooring.yaml (e.g. dsK1_manual_enriched.mooring.yaml; always overwrites)
Note:
moordiag hardwareandmoordiag singlere-enrich automatically on every run.moordiag arrayreuses existing enriched files unless--enrichis passed. Runningmoordiag enrichlets you pre-generate or refresh enriched files without producing a diagram.
Hardware YAML files use an inline / clamp structure:
name: dsK2
year: 2026
waterdepth: 925
cruise: MSM142
clamp: # instruments clamped to the mooring rope
- clamp_id: '1'
label: SM-p
image: microcat.png
hab: 633.9
inline: # hardware components in-line on the rope (bottom → top)
- position: '47'
label: Anchor
hardware_type: anchor_weight
image: anchor_wheel.png
length: 1.0See config/test_simple.mooring.yaml for a minimal example.
moordiag/ # Python package
cli.py # moordiag entry point
hardware.py # hardware diagram generator
single.py # streamlined diagram generator
drawing.py # matplotlib drawing primitives
page_generator.py # per-page layout and rendering
tools.py # layout calculation utilities
slicer.py # tall-diagram → page-height chunks
assembler.py # chunks → A4 PDF
config/ # mooring YAML configs (MSM142 cruise data)
elements/ # PNG images for mooring hardware/instruments
diagrams/ # generated output (gitignored)