Quick Start¶
Python API¶
Run the full pipeline in one call:
from urbansolarcarver import load_config, run_pipeline
cfg = load_config("config.yaml")
result = run_pipeline(cfg, out_dir="./outputs")
print(f"Carved mesh: {result.exporting.export_path}")
Or run stages individually for finer control:
from urbansolarcarver import load_config, preprocessing, thresholding, exporting
from pathlib import Path
cfg = load_config("config.yaml")
# Stage 1: compute per-voxel carving scores
pre = preprocessing(cfg, Path("outputs/preprocessing"))
# Stage 2: apply threshold to create binary mask
thr = thresholding(pre, cfg, Path("outputs/thresholding"))
# Stage 3: reconstruct mesh from mask
exp = exporting(thr, cfg, Path("outputs/exporting"))
The decomposed workflow lets you re-run thresholding with different parameters without recomputing scores.
Relative paths inside config.yaml are resolved against the YAML file's folder; the out_dir arguments above are relative to the current directory.
CLI¶
# Run stages sequentially
urbansolarcarver preprocessing -c config.yaml
urbansolarcarver thresholding -c config.yaml -f outputs/preprocessing/manifest.json
urbansolarcarver exporting -c config.yaml -f outputs/thresholding/manifest.json
# Override config values on the fly
urbansolarcarver preprocessing -c config.yaml -o voxel_size=0.5 -o mode=irradiance
# View all config options
urbansolarcarver schema
Jupyter Notebooks¶
Tutorial notebooks are in examples/:
- Quick start: basic pipeline walkthrough
- Solar envelope: time-based solar envelope
- Tilted plane & daylight: geometric and CIE overcast envelopes
- Advanced: chaining modes (annual irradiance on roofs, then daylight on windows)
- Benefit with simulated weights: hour weighting from a building simulation (ISO 13790 5R1C)

Input Requirements¶
- Max volume mesh: watertight mesh (PLY recommended; any format Trimesh reads) representing the theoretical maximum buildable volume.
- Test surface mesh: planar faces whose solar/daylight access is to be protected. Each face must be a flat panel.
- EPW weather file: hourly climate data for the site location (required for
time-based,irradianceandbenefit; not used bydaylight,tilted_planeorradiative_cooling). - All meshes must share the same coordinate system and units (meters recommended).