You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update documentation to describe default route filtering behavior
- Add "Route filtering" subsection to prediction.md explaining trip-level
vs block-level filtering, when each is used, and how to control it
- Update code examples in prediction.md to reflect new defaults (deadhead
is now opt-in, not default)
- Add explanation in index.md quickstart about filtering modes with
examples showing both trip-level and block-level usage
Agent-Logs-Url: https://github.com/NatLabRockies/routee-transit/sessions/2ff76f0b-42a6-4a2d-89df-ecd5324791de
Co-authored-by: dan-mccabe <25916826+dan-mccabe@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/index.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,17 @@ predictor.run(
34
34
)
35
35
```
36
36
37
+
By default, route filtering works at the **trip level**, so individual trips on the requested routes are always included even if their block also serves other routes. If you enable deadhead trip estimation, filtering automatically switches to **block level** to ensure complete blocks (see [](prediction) for details):
38
+
39
+
```python
40
+
predictor.run(
41
+
date="2023/08/02",
42
+
routes=["806", "807"],
43
+
add_mid_block_deadhead=True,
44
+
add_depot_deadhead=True,
45
+
)
46
+
```
47
+
37
48
For a full example, see [](examples/Utah_Transit_Agency_example).
Copy file name to clipboardExpand all lines: docs/prediction.md
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,25 @@ The full workflow proceeds in four stages:
13
13
14
14
RouteE-Transit reads a standard GTFS feed directory and loads trips along with their shape traces, stop locations, and stop times. Users can optionally filter to a specific service date and/or a subset of routes. The shape traces and scheduled stop times are used downstream to estimate average speed and distance at the road link level.
15
15
16
+
### Route filtering
17
+
18
+
By default, route filtering is **trip-level**: only trips whose `route_short_name` appears in the `routes` list are included, regardless of what other routes share the same GTFS block. This gives the most intuitive results, especially for agencies where interlining is common (e.g., a bus block might serve both route 5 and route 21).
19
+
20
+
When deadhead trips are requested (`add_mid_block_deadhead=True` or `add_depot_deadhead=True`), filtering automatically switches to **block-level** mode. In block-level mode, entire blocks are excluded if *any* trip in the block belongs to a route not in the requested set. This is necessary because deadhead estimation requires complete blocks. If block-level filtering removes all trips but trip-level filtering would have kept some, the error message will explain this and suggest alternatives (either disabling deadhead or adding the additional interlined routes to the `routes` list).
21
+
22
+
When using `filter_trips()` directly, you can control this behavior with the `use_block_filter` parameter:
23
+
24
+
```python
25
+
predictor.load_gtfs_data()
26
+
27
+
# Trip-level filtering (default) — individual trips on route "5" are
28
+
# always kept, even if their block also serves route "21"
29
+
predictor.filter_trips(routes=["5"])
30
+
31
+
# Block-level filtering — only blocks that exclusively serve route "5"
0 commit comments