compute_depot_route
Compute a full depot-to-depot trip rate from two pins. The engine snaps each pin to its nearest access cell, picks an on-ramp, routes the interstate leg, and returns a three-leg breakdown. Available for depot-capable regions: travis, ca_interstates, sw_interstates (check regions()).
HumanBaselines.compute_depot_route(
depot_a: PinLike,
depot_b: PinLike,
selections: DepotSelections | dict | None = None,
*,
county: str | None = None,
**filters,
) -> DepotComputeResultEach pin is a (lat, lon) tuple, a DepotPin, or a {"lat": ..., "lon": ...} dict. Filters work the same three ways as compute.
Example
trip = hb.compute_depot_route(
depot_a=(30.25, -97.75),
depot_b=(30.40, -97.70),
ego_vehicle=["combination"],
)
print(trip.total["rate"], trip.total["rate_low"], trip.total["rate_high"])Returns: DepotComputeResult
A three-leg trip; each leg carries its own rate metrics and total aggregates them. The model is intentionally permissive (it also carries rendering geometry), so access fields by key:
| Field | Description |
|---|---|
access_a / access_b | Access-leg metrics (geofence-shaped, with cells). |
interstate | Interstate-leg result (route-shaped, with segments). |
total | Aggregated trip rate + 95% CI. |
depot_a / depot_b | Snapped pin: s2_cell, onramp_id, route, milepost. |
access_cells_a_vertices / ..._b_vertices | Per-cell polygon corners [[lon, lat], …] for rendering. |
Snap distance
A pin farther than the server's snap limit from any known access cell raises a validation error (400). Place depots near mapped roads within the region's coverage.